Discussion:
[Mojolicious] Mojolicious::Plugin::AccessLog and x-real-ip behind reverse proxy
Dan Harris
2018-10-03 22:16:56 UTC
Permalink
I have a new Mojolicous::Lite application behind an nginx reverse proxy.
With the AccessLog plugin, the IP address of the reverse proxy is logged
every time. The nginx config seems to be OK and it was just working with a
previous (not-mojolicious) application. As a test I dumped the Request
headers in the app and the correct IP address is stored both in 'x-real-ip'
and in 'x-forwarded-for'. I am using the "combined" log format for the
plugin. It seems like the plugin is not respecting the x-forwarded-for
header. Any guidance for me?

Thank you!
--
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dan Book
2018-10-03 22:36:09 UTC
Permalink
You need to set the 'proxy' configuration for hypnotoad, or if you're not
using hypnotoad, the MOJO_REVERSE_PROXY environment variable. See
https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Reverse-proxy

-Dan
Post by Dan Harris
I have a new Mojolicous::Lite application behind an nginx reverse proxy.
With the AccessLog plugin, the IP address of the reverse proxy is logged
every time. The nginx config seems to be OK and it was just working with a
previous (not-mojolicious) application. As a test I dumped the Request
headers in the app and the correct IP address is stored both in 'x-real-ip'
and in 'x-forwarded-for'. I am using the "combined" log format for the
plugin. It seems like the plugin is not respecting the x-forwarded-for
header. Any guidance for me?
Thank you!
--
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dan Harris
2018-10-04 06:00:27 UTC
Permalink
Thank you Dan! I found the environment variable in another post about 30
seconds after I wrote this and it worked. So, I thought I deleted the
post. You were too quick for me!
Post by Dan Book
You need to set the 'proxy' configuration for hypnotoad, or if you're not
using hypnotoad, the MOJO_REVERSE_PROXY environment variable. See
https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Reverse-proxy
-Dan
Post by Dan Harris
I have a new Mojolicous::Lite application behind an nginx reverse proxy.
With the AccessLog plugin, the IP address of the reverse proxy is logged
every time. The nginx config seems to be OK and it was just working with a
previous (not-mojolicious) application. As a test I dumped the Request
headers in the app and the correct IP address is stored both in 'x-real-ip'
and in 'x-forwarded-for'. I am using the "combined" log format for the
plugin. It seems like the plugin is not respecting the x-forwarded-for
header. Any guidance for me?
Thank you!
--
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
<javascript:>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Loading...