[Catalyst] Setting an environment variable with the value of a header

Tomas Doran bobtfish at bobtfish.net
Tue Mar 26 22:01:53 GMT 2013


On 25 Mar 2013, at 10:18, Robert Rothenberg <robrwo at gmail.com> wrote:

> On 25/03/13 14:11 Tomas Doran wrote:
>> 
>> On 25 Mar 2013, at 11:51, Robert Rothenberg <robrwo at gmail.com> wrote:
>>> 
>>> The issue is getting Catalyst to use the header in place of the
>>> environment variable.
>> 
>> 
>> Erm, the remote user Authentication::Credential::Remote comes from a
>> header, not the environment already.
> 
> Really? It seems to use the REMOTE_USER variable when I've tried it.
> 
> Looking at the source code, it seems to check the environment.

Yes, but 'the environment' != environment variable.

> If Plack is translating headers into special environment variables, then
> it's a matter of telling A::C::Remote a different source.  What would be the
> name?


No, plack translates headers into the PSGI $env - this is completely orthogonal to environment variables!

I think you're conflating the two as that is how CGI traditionally works - but nothing else does this :)

>> E.g. if you run an app as external FCGI, it has it's startup environment,
>> but the remote user comes per-request down FCGI (as a header)…
> 
> I'm running the Plack server directly, not FCGI, and using a reverse proxy.

Sure - I wasn't suggesting anything about your deployment, just a thought experiment to prove it _cannot_ be an environment variable :)

Cheers
t0m




More information about the Catalyst mailing list