[Catalyst] Catalyst with HTTP authentication

Robert Rothenberg robrwo at gmail.com
Fri Mar 22 13:34:45 GMT 2013

On 22/03/13 11:46 Robert Rothenberg wrote:

> I understand how to have an Apache reverse proxy send the REMOTE_USER as a
> header, with something like
>   RequestHeader set X-Proxy-REMOTE-USER %{REMOTE_USER}
> but how to I get Authentication::Credential::Remote to use the header
> instead of the environment variable?  Do I need an auto method in Root.pm
> that checks for the header and sets $c->req->remote_user()?

I have code such as

    if (my $user = $c->req->header('X-Proxy-REMOTE-USER')) {

	$c->engine->env({ REMOTE_USER => $user });



which works, but I get a warning "env as a writer is deprecated, you
probably need to upgrade Catalyst::Engine::PSGI".

I'm unsure what to do here. Should I write a Plack::Middleware plugin that
translates the X-Proxy-REMOTE_USER header to an env->{REMOTE_USER}?

More information about the Catalyst mailing list