osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Re: original filename not getting to 403 error
page - msg#00046

List: web.nginx.english

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

On Sat, 13 Jan 2007 ianevans-H/XkN3sKs41m/Kok3h1/6Q@xxxxxxxxxxxxxxxx wrote:

Hi there...just checking if I have my 403 error call set up incorrectly.

I have my 403 set up with:

error_page 403 /dhe403.shtml;

and the referers checked with:

valid_referers none blocked *.digitalhit.com digitalhit.com
*.othersite.com;
if ($invalid_referer) {
return 403;
}

This is inside the location for the static files, which are served
directly by nginx.

When the 403 happens the php variable (.shtml is treated as .php by the
Apache backend) $_SERVER["REQUEST_URI"] is coming back as "/dhe403.shtml"
instead of the image file being requested.

Oddly enough, the 404 error page is getting the $_SERVER["REQUEST_URI"] as
the filename being requested, so its working as expected

Any reason why the 403 page's $_SERVER["REQUEST_URI"] is wrong but it's
working for the 404? Is the original requested filename not getting passed
back to Apache for some reason?

The error_page directive changes the nginx internal request URI.
If you do not rewrite URI part in the proxy_pass directive, then nginx will
pass the original URI to backend:

location / {
- proxy_pass http://backend/;
+ proxy_pass http://backend;
...
}

location /static/ {
error_page 403 /dhe403.shtml;
...
}


Igor Sysoev
http://sysoev.ru/en/




Thread at a glance:

Previous Message by Date:

original filename not getting to 403 error page

Hi there...just checking if I have my 403 error call set up incorrectly. I have my 403 set up with: error_page 403 /dhe403.shtml; and the referers checked with: valid_referers none blocked *.digitalhit.com digitalhit.com *.othersite.com; if ($invalid_referer) { return 403; } This is inside the location for the static files, which are served directly by nginx. When the 403 happens the php variable (.shtml is treated as .php by the Apache backend) $_SERVER["REQUEST_URI"] is coming back as "/dhe403.shtml" instead of the image file being requested. Oddly enough, the 404 error page is getting the $_SERVER["REQUEST_URI"] as the filename being requested, so its working as expected Any reason why the 403 page's $_SERVER["REQUEST_URI"] is wrong but it's working for the 404? Is the original requested filename not getting passed back to Apache for some reason? Thanks.

Next Message by Date:

Re: original filename not getting to 403 error page

> location / { > - proxy_pass http://backend/; > + proxy_pass http://backend; > ... > } > > location /static/ { > error_page 403 /dhe403.shtml; > ... > } Thanks! That fixed it immediately. I've now fully replaced my previous lighttpd setup with nginx reverse proxying to Apache. Nginx is handling the static stuff. Just did a quick http_load test and the request per second were 4 times higher. Thanks!

Previous Message by Thread:

original filename not getting to 403 error page

Hi there...just checking if I have my 403 error call set up incorrectly. I have my 403 set up with: error_page 403 /dhe403.shtml; and the referers checked with: valid_referers none blocked *.digitalhit.com digitalhit.com *.othersite.com; if ($invalid_referer) { return 403; } This is inside the location for the static files, which are served directly by nginx. When the 403 happens the php variable (.shtml is treated as .php by the Apache backend) $_SERVER["REQUEST_URI"] is coming back as "/dhe403.shtml" instead of the image file being requested. Oddly enough, the 404 error page is getting the $_SERVER["REQUEST_URI"] as the filename being requested, so its working as expected Any reason why the 403 page's $_SERVER["REQUEST_URI"] is wrong but it's working for the 404? Is the original requested filename not getting passed back to Apache for some reason? Thanks.

Next Message by Thread:

Re: original filename not getting to 403 error page

> location / { > - proxy_pass http://backend/; > + proxy_pass http://backend; > ... > } > > location /static/ { > error_page 403 /dhe403.shtml; > ... > } Thanks! That fixed it immediately. I've now fully replaced my previous lighttpd setup with nginx reverse proxying to Apache. Nginx is handling the static stuff. Just did a quick http_load test and the request per second were 4 times higher. Thanks!
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!