will request_uri get passed from cookieless server to 403 page on main server?

Francis Daly francis at daoine.org
Tue Nov 19 09:31:14 UTC 2013


On Tue, Nov 19, 2013 at 04:13:30AM -0500, Ian Evans wrote:
> On 18/11/2013 6:26 PM, Francis Daly wrote:

Hi there,

> Just to clarify, the two "servers" are on same physical box with the 
> same document root, just migrating to a better host. So php is 
> installed.

> On the www block, I currently have this 403 block:
> 
> error_page 403 = /dhe403.shtml;
> location = /dhe403.shtml {
> fastcgi_pass unix:/var/run/php-fpm.sock;
> fastcgi_cache  off;
> }
> 
> So I could add that to my static block as well?

Yes.

*If* that php is set to always return cookies, then you might want to
run a separate php-fpm that does not return cookies for the static
site. But that's a side issue.

> Also, I'd have this "rewrite anything not static" location in the static 
> server:
> 
> if ($request_uri !~* 
> "\.(gif|js|jpg|jpeg|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mov)$") 
> {
> rewrite ^(.*) http://www.example.com$1 permanent;
> break;
> }

That's not a location. That's an if() block.

> If I put the 403 location before it, will it still redirect any 
> non-static files EXCEPT for the dhe403.shtml?

I believe that if() at server level gets tested before all locations --
but it shouldn't be too hard to check.

Compare that output of "curl -i url" with what you want to see.

If it doesn't work first time, perhaps putting the if() block inside a
"location /" and adjusting accordingly would do what you want.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list