[Catalyst] How to get IP address of the interface which therequest
come through
N.A.
n-a at u01.gate01.com
Sun Mar 31 05:57:22 GMT 2013
Thank you all,
I can't find `more direct way of getting the IP address' nor way of
getting the network interface of the HTTP-request. The following is
summary of what I learned from this ML and source code.
- 'SERVER_ADDR' environment variable is not portable.
PSGI Specification says nothing on this variable.
- It is HTTP server, not the Catalyst who chooses to support
this variable or not.
The lighttpd support 'SERVER_ADDR',
the nginx needs additional configuration to support this, and
HTTP::Server::PSGI(which is used by Catalyst test server) doesn't
support.
- In many cases, host name( '$c->req->uri->host' ) is more suitable
because it is IP version neutral.
N.A.
(2013年03月24日 15:33), Octavian Rasnita wrote:
> From: "N.A." <n-a at u01.gate01.com>
> To: <catalyst at lists.scsys.co.uk>
>
>> >> I wan to get the IP address of the interface(network device)
>> which the
>> >> request come through.
>> >
>> > My bad.
>
>
>
> Unless there is a more direct way of getting the IP address, you can
> create distinct virtual hosts for each IP address that can access your
> web app and set an HTTP environment variable that specifies that IP
> address. Then read that env var in your app.
>
> --Octavian
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list