Welcome! Log In Create A New Profile

Advanced

Re: error_page

October 20, 2010 01:06PM
On Wed, Oct 20, 2010 at 05:58:09PM +0200, witekfl@gazeta.pl wrote:

> On Wed, Oct 20, 2010 at 07:21:19PM +0400, Igor Sysoev wrote:
> > On Wed, Oct 20, 2010 at 05:10:59PM +0200, witekfl Gazeta.pl wrote:
> >
> > > Hi,
> > > probably better place for these questions would be nginx-users, but I ask
> > > here.
> > > I want to serve static pages as error codes but without changing the error
> > > code.
> > >
> > > Now if:
> > > error_page 404 http://blablabla.com/404.html
> > > There is 302 and next 200 OK
> > > I want 404.
> > >
> > > error_page 404 /404.html
> > > it works, but:
> > > if there is:
> > > location = /404.html {
> > > internal;
> > > }
> > > then cannot be a normal location
> > > location = /404.html {
> > > },
> > > so request such as http://blabla1.com/404.html won't work.
> > >
> > > error_page 404 @404;
> > > location @404 {
> > > root /blabla;
> > > index 404.html;
> > > }
> > > doesn't work either
> > >
> > > There must be some way to achieve it.
> > > How?
> >
> > I do not understand the problem. With this configuration
> >
> > error_page 404 /404.html;
> > locaiton = /404.html {
> > internal;
> > root /path/to/page;
> > }
> >
> > you will get 404 code with /404.html body for both requests:
> >
> > http://blabla1.com/non-existant.html
> > http://blabla1.com/404.html
>
> Yes, but I want:
> http://blabla1.com/404.html to be 200 OK and serve http://blabla1.com/404.html
> not /path/to/page/404.html

I still do not understand what you want.

With this configuration

error_page 404 /404.html;
locaiton = /404.html {
root /path/to/page;
}

you will get 404 code with /404.html body for this request:
http://blabla1.com/non-existant.html

and 200 code with /404.html body for this request:
http://blabla1.com/404.html


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

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

error_page

witekfl Gazeta.pl 2077 October 20, 2010 11:12AM

Re: error_page

Igor Sysoev 893 October 20, 2010 11:22AM

Re: error_page

Anonymous User 839 October 20, 2010 12:00PM

Re: error_page

Maxim Dounin 814 October 20, 2010 12:26PM

Re: error_page

Witold Filipczyk 808 October 20, 2010 01:08PM

Re: error_page

Maxim Dounin 833 October 20, 2010 01:36PM

Re: error_page

Igor Sysoev 918 October 20, 2010 01:42PM

Re: error_page

Maxim Dounin 867 October 20, 2010 01:50PM

Re: error_page

Igor Sysoev 967 October 20, 2010 01:58PM

Re: error_page

Igor Sysoev 924 October 20, 2010 01:06PM

Re: error_page

Witold Filipczyk 841 October 20, 2010 01:28PM

Re: error_page

Igor Sysoev 966 October 20, 2010 01:38PM

Re: error_page

Witold Filipczyk 1186 October 20, 2010 01:58PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 112
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready