Discussion:
EventEmitter
(too old to reply)
Stefan Adams
2012-12-17 22:05:46 UTC
Permalink
http://search.cpan.org/~sri/Mojolicious/lib/Mojo/EventEmitter.pm#on

Can the documentation for Mojo::EventEmitter 'on' method be updated to
directly state that only one event can be registered per call? (Or, if it
makes sense, can the 'on' method be updated to accept more than one
subscription event per call?

In examples, I've been seeing this:

$self->on(message => sub { ... });
$self->on(error => sub { ... });

So obviously that works.

For no reason other than my own poor judgement, I assumed I could do this:

$self->on(
message => sub { ... },
error => sub { ... },
);

Perhaps I'm not alone in thinking documentation to clearly state single
subscriptions only would be useful or updating the method to accept
multiple event subscriptions in a single call?

Just a thought.

Thanks!
Stefan
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mojolicious+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
Sebastian Riedel
2012-12-17 22:16:13 UTC
Permalink
Can the documentation for Mojo::EventEmitter 'on' method be updated to directly state that only one event can be registered per call?
IMHO Reference documentation is supposed to tell you what you can do, not what you can't.

--
Sebastian Riedel
http://twitter.com/kraih
http://mojolicio.us
Ed W
2012-12-20 23:56:59 UTC
Permalink
Post by Sebastian Riedel
Can the documentation for Mojo::EventEmitter 'on' method be updated to directly state that only one event can be registered per call?
IMHO Reference documentation is supposed to tell you what you can do, not what you can't.
It doesn't seem inconsistent to judiciously use "can't do" in order to
clarify "can do"?

Ed W
Wes Cravens
2012-12-26 16:49:27 UTC
Permalink
I'm testing deployment proxied under a non root uri. I've proxied at
http://[host]/app through nginx to morbo/hypnotoad with no uri
manipulation. I then use the:

push @{$self->req->url->base->path->parts},
shift @{$self->req->url->path->parts};

trick to alter the base. This seems to work ok for

http://[host]/app

but not for

http://[host]/app/

The latter gives a 404 with: "None of these routes matched your GET
request for //, maybe you need to add a new one?"

I'm testing on a fresh app with only the
$r->get('/')->to('example#welcome');
router.

Should what I'm trying work or is there something more I need to be
correcting in my before_dispatch hook or otherwise?

Wes
sdnpol
2013-06-07 08:24:47 UTC
Permalink
I have the same problem, did you resolve it =?
thanks
paolo
Post by Wes Cravens
I'm testing deployment proxied under a non root uri. I've proxied at
http://[host]/app through nginx to morbo/hypnotoad with no uri
trick to alter the base. This seems to work ok for
http://[host]/app
but not for
http://[host]/app/
The latter gives a 404 with: "None of these routes matched your GET
request for //, maybe you need to add a new one?"
I'm testing on a fresh app with only the
$r->get('/')->to('example#welcome');
router.
Should what I'm trying work or is there something more I need to be
correcting in my before_dispatch hook or otherwise?
Wes
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Gabriel Vieira
2013-06-07 12:42:40 UTC
Permalink
X-Received: by 10.180.11.148 with SMTP id q20mr98390wib.17.1370608981939;
Fri, 07 Jun 2013 05:43:01 -0700 (PDT)
X-BeenThere: ***@googlegroups.com
Received: by 10.180.198.142 with SMTP id jc14ls156565wic.34.canary; Fri, 07
Jun 2013 05:43:00 -0700 (PDT)
X-Received: by 10.204.224.8 with SMTP id im8mr1480905bkb.5.1370608980700;
Fri, 07 Jun 2013 05:43:00 -0700 (PDT)
Received: from mail-la0-x231.google.com (mail-la0-x231.google.com [2a00:1450:4010:c03::231])
by gmr-mx.google.com with ESMTPS id cm16si5780685bkb.0.2013.06.07.05.43.00
for <***@googlegroups.com>
(version=TLSv1 cipherìDHE-RSA-RC4-SHA bits8/128);
Fri, 07 Jun 2013 05:43:00 -0700 (PDT)
Received-SPF: pass (google.com: domain of ***@gmail.com designates 2a00:1450:4010:c03::231 as permitted sender) client-ip*00:1450:4010:c03::231;
Received: by mail-la0-x231.google.com with SMTP id ea20so132460lab.8
for <***@googlegroups.com>; Fri, 07 Jun 2013 05:43:00 -0700 (PDT)
X-Received: by 10.152.7.39 with SMTP id g7mr2430514laa.72.1370608980487; Fri,
07 Jun 2013 05:43:00 -0700 (PDT)
Received: by 10.112.134.234 with HTTP; Fri, 7 Jun 2013 05:42:40 -0700 (PDT)
In-Reply-To: <efa8e4d2-9d75-4615-9318-***@googlegroups.com>
X-Original-Sender: ***@gmail.com
X-Original-Authentication-Results: gmr-mx.google.com; spf=pass
(google.com: domain of ***@gmail.com designates
2a00:1450:4010:c03::231 as permitted sender) smtp.mail=***@gmail.com;
dkim=pass header.i=@gmail.com
Precedence: list
Mailing-list: list ***@googlegroups.com; contact mojolicious+***@googlegroups.com
List-ID: <mojolicious.googlegroups.com>
X-Google-Group-Id: 522435015060
List-Post: <http://groups.google.com/group/mojolicious/post?hl=en_US>, <mailto:***@googlegroups.com>
List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:mojolicious+***@googlegroups.com>
List-Archive: <http://groups.google.com/group/mojolicious?hl=en_US>
Sender: ***@googlegroups.com
List-Subscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:mojolicious+***@googlegroups.com>
List-Unsubscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:googlegroups-manage+522435015060+***@googlegroups.com>
Archived-At: <http://permalink.gmane.org/gmane.comp.web.mojolicious/1265>

What is the nginx configuration?
Post by sdnpol
I have the same problem, did you resolve it =?
thanks
paolo
Post by Wes Cravens
I'm testing deployment proxied under a non root uri. I've proxied at
http://[host]/app through nginx to morbo/hypnotoad with no uri
trick to alter the base. This seems to work ok for
http://[host]/app
but not for
http://[host]/app/
The latter gives a 404 with: "None of these routes matched your GET
request for //, maybe you need to add a new one?"
I'm testing on a fresh app with only the
$r->get('/')->to('example#welcome');
router.
Should what I'm trying work or is there something more I need to be
correcting in my before_dispatch hook or otherwise?
Wes
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
Gabriel Vieira
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
sdnpol
2013-06-07 13:19:13 UTC
Permalink
upstream presidi {
server 127.0.0.1:8001;
}
upstream mobile {
server 127.0.0.1:8002;
}
server {
listen 80;
server_name 192.168.7.7 presidi.regione.vda.it;
location /mobile/ {
#rewrite ^/mobile(.*)$ $1 break;
proxy_pass http://mobile;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-HTTPS 0;
}
location / {
proxy_pass http://presidi;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-HTTPS 0;
}
}


I tried to enable the line "rewrite ^/mobile(.*)$ $1 break;" but then all
the javascripts cannnot be found,
so the stylesheet link href="/mobile/themes/ecometer.min.css" become
href="/themes/ecometer.min.css".


thank
paolo
Post by Gabriel Vieira
What is the nginx configuration?
Post by sdnpol
I have the same problem, did you resolve it =?
thanks
paolo
Il giorno mercoledì 26 dicembre 2012 17:49:27 UTC+1, wcravens ha
Post by Wes Cravens
I'm testing deployment proxied under a non root uri. I've proxied at
http://[host]/app through nginx to morbo/hypnotoad with no uri
trick to alter the base. This seems to work ok for
http://[host]/app
but not for
http://[host]/app/
The latter gives a 404 with: "None of these routes matched your GET
request for //, maybe you need to add a new one?"
I'm testing on a fresh app with only the
$r->get('/')->to('example#welcome');
router.
Should what I'm trying work or is there something more I need to be
correcting in my before_dispatch hook or otherwise?
Wes
--
You received this message because you are subscribed to the Google
Groups
Post by sdnpol
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by sdnpol
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
Gabriel Vieira
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Gabriel Vieira
2013-06-07 13:20:37 UTC
Permalink
Post by sdnpol
proxy_pass http://mobile;
try:
proxy_pass http://mobile/;

--
Gabriel Vieira
sdnpol
2013-06-07 14:17:20 UTC
Permalink
I tried without success, no i get href="//themes/ecometer.min.css<http://themes/ecometer.min.css>
"


here is the hook :

sub startup {
my $self = shift;

$self->hook(before_dispatch => sub {
my $self = shift;
push @{$self->req->url->base->path->parts}, shift
@{$self->req->url->path->parts};
});
....
routes
}


thanks
paolo
Post by Gabriel Vieira
Post by sdnpol
proxy_pass http://mobile;
proxy_pass http://mobile/;
--
Gabriel Vieira
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Wes Cravens
2013-06-08 01:12:22 UTC
Permalink
X-Received: by 10.180.91.40 with SMTP id cb8mr4573wib.16.1370653966536;
Fri, 07 Jun 2013 18:12:46 -0700 (PDT)
X-BeenThere: ***@googlegroups.com
Received: by 10.180.9.47 with SMTP id w15ls370063wia.17.canary; Fri, 07 Jun
2013 18:12:45 -0700 (PDT)
X-Received: by 10.14.95.130 with SMTP id p2mr1669354eef.6.1370653965200;
Fri, 07 Jun 2013 18:12:45 -0700 (PDT)
Received: from outmail149085.authsmtp.co.uk (outmail149085.authsmtp.co.uk. [62.13.149.85])
by gmr-mx.google.com with ESMTP id bj52si277512eeb.1.2013.06.07.18.12.45
for <***@googlegroups.com>;
Fri, 07 Jun 2013 18:12:45 -0700 (PDT)
Received-SPF: neutral (google.com: 62.13.149.85 is neither permitted nor denied by best guess record for domain of ***@cortex-it.com) client-ipb.13.149.85;
Received: from mail-c233.authsmtp.com (mail-c233.authsmtp.com [62.13.128.233])
by punt9.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id r581Ci3j076922
for <***@googlegroups.com>; Sat, 8 Jun 2013 02:12:44 +0100 (BST)
Received: from [IPv6:::1] (c-24-13-88-251.hsd1.il.comcast.net [24.13.88.251])
(authenticated bits=0)
by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id r581CfDO075275
for <***@googlegroups.com>; Sat, 8 Jun 2013 02:12:43 +0100 (BST)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
In-Reply-To: <efa8e4d2-9d75-4615-9318-***@googlegroups.com>
X-Server-Quench: 85cc84c2-cfd8-11e2-a49c-0025907707a1
X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse
X-AuthRoute: OCdyZA4UAFZKRx4T FC4CFwdLTh85Kw0J AANFJgxfNl8OVwNV M01bKUdIGFIbQl5d VjFJBBEUE0MiBj47 awJOF0ADfUhOXgZ6 UEpDQ1BYEAYmAxgf Bx0AWhFsdQBHZ3x1 Z0N9Xj4ZWUx7BhAJ PU5TEG8BYCliaWYe HkhdJFBcdFBIY0wT PlhiVXJYY3hWYnMz WldrZW1gZWoAcHtc Gxc3IABacmMMHDk4 RhsDGig0KAU/Snd7 CRMnLE5UJFwWIlR6 N1wnEUgfNANaFxdf dwAA
X-Authentic-SMTP: 61633134363133.1021:706
X-AuthFastPath: 0 (Was 255)
X-AuthSMTP-Origin: 24.13.88.251/2525
X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system.
X-Original-Sender: ***@cortex-it.com
X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral
(google.com: 62.13.149.85 is neither permitted nor denied by best guess
record for domain of ***@cortex-it.com) smtp.mail=***@cortex-it.com
Precedence: list
Mailing-list: list ***@googlegroups.com; contact mojolicious+***@googlegroups.com
List-ID: <mojolicious.googlegroups.com>
X-Google-Group-Id: 522435015060
List-Post: <http://groups.google.com/group/mojolicious/post?hl=en_US>, <mailto:***@googlegroups.com>
List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:mojolicious+***@googlegroups.com>
List-Archive: <http://groups.google.com/group/mojolicious?hl=en_US>
Sender: ***@googlegroups.com
List-Subscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:mojolicious+***@googlegroups.com>
List-Unsubscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:googlegroups-manage+522435015060+***@googlegroups.com>
Archived-At: <http://permalink.gmane.org/gmane.comp.web.mojolicious/1269>

Nope.

Wes
Post by sdnpol
I have the same problem, did you resolve it =?
thanks
paolo
I'm testing deployment proxied under a non root uri. I've proxied at
http://[host]/app through nginx to morbo/hypnotoad with no uri
trick to alter the base. This seems to work ok for
http://[host]/app
but not for
http://[host]/app/
The latter gives a 404 with: "None of these routes matched your GET
request for //, maybe you need to add a new one?"
I'm testing on a fresh app with only the
$r->get('/')->to('example#welcome');
router.
Should what I'm trying work or is there something more I need to be
correcting in my before_dispatch hook or otherwise?
Wes
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Sebastian Riedel
2013-06-08 02:17:11 UTC
Permalink
It appears a lot of folks were just cargo culting the cookbook recipe for path rewriting, which rarely works, so i've replaced it with something simpler that might do a better job of getting the point across.

https://github.com/kraih/mojo/commit/efcf40b7615427dfe0328675e2b74a28e36aa812

--
Sebastian Riedel
http://twitter.com/kraih
http://mojolicio.us
sdnpol
2013-06-08 08:12:38 UTC
Permalink
Thanks a lot !!,
I managed to make it working, all the links are correct

nginx config :
upstream mobile {
server 127.0.0.1:8002;
}
server {
.........
location /mobile {
proxy_pass http://mobile;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-HTTPS 0;
}
}

mojolicious:

sub startup {
my $self = shift;

$self->hook(before_dispatch => sub {
my $self = shift;

$self->req->url->base(Mojo::URL->new('http://presidi.regione.vda.it/'));
$self->req->url->path->leading_slash(0);
push @{$self->req->url->base->path}, shift @{$self->req->url->path};
}) if $self->mode eq 'production';
........
}

paolo
Post by Sebastian Riedel
It appears a lot of folks were just cargo culting the cookbook recipe for
path rewriting, which rarely works, so i've replaced it with something
simpler that might do a better job of getting the point across.
https://github.com/kraih/mojo/commit/efcf40b7615427dfe0328675e2b74a28e36aa812
--
Sebastian Riedel
http://twitter.com/kraih
http://mojolicio.us
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
sri
2013-06-08 17:06:20 UTC
Permalink
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20120113;
h=x-beenthere:mime-version:date:in-reply-to:references:user-agent
:x-http-useragent:message-id:subject:from:to:x-original-sender
:x-original-authentication-results:reply-to:precedence:mailing-list
:list-id:x-google-group-id:list-post:list-help:list-archive:sender
:list-subscribe:list-unsubscribe:content-type;
bh=CWgd+zF4UbbOZYDTPe+1LmYlY4Wk5+Pei9IeQy3Nzqw=;
b=Bj3bQnRR1IJiXP1qSi355MDDyOrVH3cYbnLpO7dBXI8GjDV0y2xXEMpvUtf7dHc1zt
LERrDDfBRlGxrs/Es5De0OJ90suEhkhjPHqCv2NDUO+7HKrs/o+cfohBinXqjCMmH5+D
azK0p1oJzyfnPp+z1FgvaJI0r2CyllNVex4kTrLHRjo6vtGd4fjfb3AUSb7BuZKKttSK
7KtA1i3hZxPHwJ2gzTE8sw9K6XcZuRL4XE2ypqPLd61bX1nYX2gKPLnBLC7TPRIAyp5L
W+i1qEEv5lpQIsTCfx8Kj6GE6NV6zGTgKOTd6Dxea46jEa+zToNCb9g8oPx+vQHuf28g

X-Received: by 10.49.27.138 with SMTP id t10mr163260qeg.31.1370711181635;
Sat, 08 Jun 2013 10:06:21 -0700 (PDT)
X-BeenThere: ***@googlegroups.com
Received: by 10.49.98.99 with SMTP id eh3ls2231028qeb.15.gmail; Sat, 08 Jun
2013 10:06:20 -0700 (PDT)
X-Received: by 10.49.0.81 with SMTP id 17mr166156qec.16.1370711180394; Sat, 08
Jun 2013 10:06:20 -0700 (PDT)
Received: by w7g2000vbw.googlegroups.com with HTTP; Sat, 8 Jun 2013 10:06:20
-0700 (PDT)
In-Reply-To: <e3521742-2b52-4e81-8078-***@googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4)
AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1,gzip(gfe)
X-Original-Sender: ***@googlemail.com
X-Original-Authentication-Results: ls.google.com; spf=pass (google.com: domain
of ***@googlemail.com designates internal as permitted sender)
smtp.mail=***@googlemail.com; dkim=pass header.i=@googlemail.com
Precedence: list
Mailing-list: list ***@googlegroups.com; contact mojolicious+***@googlegroups.com
List-ID: <mojolicious.googlegroups.com>
X-Google-Group-Id: 522435015060
List-Post: <http://groups.google.com/group/mojolicious/post?hl=en_US>, <mailto:***@googlegroups.com>
List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:mojolicious+***@googlegroups.com>
List-Archive: <http://groups.google.com/group/mojolicious?hl=en_US>
Sender: ***@googlegroups.com
List-Subscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:mojolicious+***@googlegroups.com>
List-Unsubscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:googlegroups-manage+522435015060+***@googlegroups.com>
Archived-At: <http://permalink.gmane.org/gmane.comp.web.mojolicious/1272>

Looks like i can't really prevent the cargo culting... so lets try a
more fool-proof recipe with a hint at what to watch out for.

https://github.com/kraih/mojo/commit/268dd3e595ba12103c3fc89b83c08f11d9d6fe77

--
sebastian
sri
2013-06-08 17:48:45 UTC
Permalink
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20120113;
h=x-beenthere:mime-version:date:in-reply-to:references:user-agent
:x-http-useragent:message-id:subject:from:to:x-original-sender
:x-original-authentication-results:reply-to:precedence:mailing-list
:list-id:x-google-group-id:list-post:list-help:list-archive:sender
:list-subscribe:list-unsubscribe:content-type;
bh=cVXp16cFdF0FvRlVaHQtLmnQl9a040mbN2IasCF5QeQ=;
b=0Gn0O6UAokuBgCk1pgDnRRq4wTZJvgrjfP8uAAL3bkO9fASGwxVJsAJpeH4T4jG05K
YK1iZff8gSMm1n0w0/VjJm3XhCLaD9auWSXl9vsmcv65dxWKFUxptxof4FEvQ/5Fz+hz
OQQsj5rvVCgRYiOYjk+vJ9CiDlI3pbOgwg3jcQSKWjSfziQ650/Hjz1O4nfyH5Qx8uLy
d6cM43M3ow5tAH8CQfjI7cdZbcPlPPsWygr0dYQbjWjdilcDzKnZC0soMwbHCegJSAEx
vpPXLdSABAGM+QHkCUnmsCYxLi+4mn25sBrr7wtyZrKcPpo/13jmt7d5cuiZModerqzs

X-Received: by 10.49.121.9 with SMTP id lg9mr167317qeb.39.1370713727971;
Sat, 08 Jun 2013 10:48:47 -0700 (PDT)
X-BeenThere: ***@googlegroups.com
Received: by 10.49.52.40 with SMTP id q8ls2267709qeo.1.gmail; Sat, 08 Jun 2013
10:48:45 -0700 (PDT)
X-Received: by 10.49.0.81 with SMTP id 17mr172460qec.16.1370713725752; Sat, 08
Jun 2013 10:48:45 -0700 (PDT)
Received: by m13g2000vbo.googlegroups.com with HTTP; Sat, 8 Jun 2013 10:48:45
-0700 (PDT)
In-Reply-To: <0f3a931c-89b2-4601-88cb-***@w7g2000vbw.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4)
AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1,gzip(gfe)
X-Original-Sender: ***@googlemail.com
X-Original-Authentication-Results: ls.google.com; spf=pass (google.com: domain
of ***@googlemail.com designates internal as permitted sender)
smtp.mail=***@googlemail.com; dkim=pass header.i=@googlemail.com
Precedence: list
Mailing-list: list ***@googlegroups.com; contact mojolicious+***@googlegroups.com
List-ID: <mojolicious.googlegroups.com>
X-Google-Group-Id: 522435015060
List-Post: <http://groups.google.com/group/mojolicious/post?hl=en_US>, <mailto:***@googlegroups.com>
List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:mojolicious+***@googlegroups.com>
List-Archive: <http://groups.google.com/group/mojolicious?hl=en_US>
Sender: ***@googlegroups.com
List-Subscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:mojolicious+***@googlegroups.com>
List-Unsubscribe: <http://groups.google.com/group/mojolicious/subscribe?hl=en_US>,
<mailto:googlegroups-manage+522435015060+***@googlegroups.com>
Archived-At: <http://permalink.gmane.org/gmane.comp.web.mojolicious/1273>

And some more details, i want readers to understand the purpose of the
base/relative URL split.

https://github.com/kraih/mojo/commit/693f9a562e569a80a564ff7eb2e1be146445af31

--
sebastian
sdnpol
2013-06-09 06:22:02 UTC
Permalink
Thank a lot for your time and the great job !
paolo
Post by sri
And some more details, i want readers to understand the purpose of the
base/relative URL split.
https://github.com/kraih/mojo/commit/693f9a562e569a80a564ff7eb2e1be146445af31
--
sebastian
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Roland Lammel
2013-06-10 07:11:29 UTC
Permalink
I tend do use an additional X-Forwarded-Base header, which includes the
base URI for the application.
The main reason is that I want the reverse proxy to be the endpoint for
communication (usually an https endpoint and have internally only http
communication, making it traceable and allowing intrusion detection).
To support true white labaling of a web application they sometimes shall be
accessable under completely different URL, IP addresses and even paths, so
there is no pattern I could follow.
The frontend reverse proxy is the one deciding which base URL shall be used
for the application.

Taken from my production nginx configuration:

location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Base $scheme://$server_name;
}

And the
$self->app->hook(before_dispatch => sub {
my $forward_base = $self->req->headers->header('X-Forwarded-Base');
$self->req->url->base(Mojo::URL->new($forward_base)) if
$forward_base;
}

Why X-Forwarded-Base?

As the X-Forwarded headers are not standarized anyway, I decided to take
the simple approch (as I do not need https in the backend) and just use the
absolute URI directly and not splitting it up into it's elements (scheme,
host, ...)

Hope that sheds some light on the use case for it.

BR

+rl

+rl
--
Roland Lammel
QuikIT - IT Lösungen - flexibel und schnell
Web: http://www.quikit.at
Phone: +43 (676) 9737845
Email: ***@quikit.at

"Enjoy your job, make lots of money, work within the law. Choose any two."
Post by sri
And some more details, i want readers to understand the purpose of the
base/relative URL split.
https://github.com/kraih/mojo/commit/693f9a562e569a80a564ff7eb2e1be146445af31
--
sebastian
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Continue reading on narkive:
Loading...