rewrite server responses

Maxim Dounin mdounin at mdounin.ru
Tue Oct 5 14:55:22 MSD 2010


Hello!

On Mon, Oct 04, 2010 at 09:36:24PM +0200, Julien Vehent wrote:

> On Mon, 04 Oct 2010 12:20:54 -0400, "Dayo" <nginx-forum at nginx.us> wrote:
> > Try putting it into the php location instead.
> > 
> 
> Still the same....
> 
> ----
>         location ~ \.php$ {
>                 port_in_redirect off;
>                 include fastcgi_params;
>                 fastcgi_pass    unix:/var/run/spawn-fcgi-php5.socket;
>                 fastcgi_index  index.php;
>                 fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
>         }
> ----
> 
> 
> Could it be cached somewhere ?
> I have haproxy as a frontend, but it really only does HTTP requests/responses balancing.

As long as you use fastcgi and your fastcgi application 
returns wrong redirect - you should convince it to return correct 
one by providing appropriate fastcgi_param's.

Changing fastcgi_param SERVER_PORT to 80 should be enough as far 
as I understand your case.

Rewriting of 'Location' header returned by backend only available 
for proxy (see proxy_redirect directive), where it's not possible 
to control backend's idea about correct server address.

Maxim Dounin



More information about the nginx mailing list