kopug memo


Catalyst を Reverse Proxy の後ろに置く場合

perldoc Catalyst

Many production servers operate using the common double-server approach, with a
lightweight frontend web server passing requests to a larger backend server. An
application running on the backend server must deal with two problems: the remote
user always appears to be and the server’s hostname will appear to be
"localhost" regardless of the virtual host that the user connected through.

Catalyst will automatically detect this situation when you are running the frontend
and backend servers on the same machine. The following changes are made to the

$c->req->address is set to the user’s real IP address, as read from
the HTTP X-Forwarded-For header.

The host value for $c->req->base and $c->req->uri is set to the real
host, as read from the HTTP X-Forwarded-Host header.

Obviously, your web server must support these headers for this to work.

In a more complex server farm environment where you may have your frontend proxy
server(s) on different machines, you will need to set a configuration option to
tell Catalyst to read the proxied data from the headers.

MyApp->config->{using_frontend_proxy} = 1;

If you do not wish to use the proxy support at all, you may set:

MyApp->config->{ignore_frontend_proxy} = 1;