error_page broken in 0.4.5?

Bob Ippolito bob at redivi.com
Tue Oct 3 09:02:55 MSD 2006


On 10/2/06, Igor Sysoev <is at rambler-co.ru> wrote:
> On Mon, 2 Oct 2006, Bob Ippolito wrote:
>
> > I just upgraded to 0.4.5, and it seems that error_page no longer works
> > correctly. If I specify "error_page 404 404.html;" then it will do a
> > Location redirect to 404.html, but if I specify "error_page
> > /404.html;" then I will just get the default nginx 404 page.
> >
> > In 0.4.2 I could use "error_page /404.html;" and get the contents of
> > 404.html (this is the documented behavior).
> >
> > $ curl -I http://127.0.0.1/nothere
> > HTTP/1.1 404 Not Found
> > Server: nginx/0.4.5
> > Date: Tue, 03 Oct 2006 02:26:21 GMT
> > Content-Type: text/html
> > Content-Length: 168
> > Connection: keep-alive
> >
> > $ curl -I http://127.0.0.1/nothere
> > HTTP/1.1 302 Moved Temporarily
> > Server: nginx/0.4.5
> > Date: Tue, 03 Oct 2006 02:26:50 GMT
> > Content-Type: text/html
> > Content-Length: 160
> > Connection: keep-alive
> > Location: 404.html
>
> "error_page /404.html;" is invalid directive. If you run "nginx -t",
> it should show you: "invalid number arguments in directive "error_page"".
> The same error should be in error file after -HUP and nginx will run with
> previous configiration.
>
> The correct directives are
> error_page  404  /404.html;
> or
> error_page  403 404  /404.html;

You're right, I was in a hurry and typing it from memory. It actually
says "error_page 404 /404.html;" but it still does not work. The
configuration is valid syntax.

-bob





More information about the nginx mailing list