Setting the status code

Dennis Jacobfeuerborn dennisml at conversis.de
Tue Aug 6 03:02:00 UTC 2013


Hi,
I'm wondering how I can set a status code and still deliver a custom web 
page? Specifically I want to use a status code of 403 Forbidden but 
depending on the exact reason I want to display different custom error 
pages for that case.
When I use the "return 403" directive I can no longer deliver content 
and at most a single custom page can be returned which is defined by the 
error_page directive.

Since I determine the reason for the denied access in lua a way to do it 
there would also help. I already tried "nginx.status = 403" followed by 
a "nginx.exec('/reason1')" but while the right page is display the 
status code returned gets reset to 200.

Any ideas?

Regards,
   Dennis



More information about the nginx mailing list