Welcome! Log In Create A New Profile

Advanced

Re: is there a way to avoid output body when a request is calling for a vhost that not exist?

Igor Sysoev
December 06, 2009 04:40AM
On Sun, Dec 06, 2009 at 12:38:01PM +0800, tOmasEn wrote:

> Great. Thanks
>
> But then another question popup:
>
> When use proxy_pass , if the backend server use above technique. The
> front-end server will return 502 error and error message html.
>
> Is there an easy way do avoid such output? :| might not be I guess. It's a
> bit of tricky

You should use this server at frontend.

As to your question:

error_page 502 = @444;

location @444 { return 444; }


> On Sun, Dec 6, 2009 at 1:49 AM, Igor Sysoev <igor@sysoev.ru> wrote:
>
> > On Sun, Dec 06, 2009 at 01:27:31AM +0800, tOmasEn wrote:
> >
> > > is there a way to avoid output body when a request is calling for a vhost
> > > that not exist?
> > >
> > > Normally when user send a request to nginx server for a server name
> > doesn't
> > > exits on nginx server, nginx will reply "Bad Hostname".
> > >
> > > If you (me) add following lines :
> > >
> > > server {
> > > listen 80;
> > > server_name _;
> > > location / {
> > > return 404;
> > > }
> > > }
> > >
> > > some cases of nginx return 404, some return 403.
> > >
> > > And in all cases, nginx return a html error page with error message in
> > body.
> > >
> > > Is there a way just return 404 and do not return any more error message
> > when
> > > user request for a server name which does not exist? OR EVEN BETTER, just
> > > don't return anything like the server is dead to those request?
> > >
> > > Thanks for any suggestion. I love nginx.
> >
> >
> > http://nginx.org/docs/http/request_processing.html#how_to_prevent_wrong_server_names
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> >
>
>
>
> --
> Tomasen
> http://twitter.com/ShooterPlayer

> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx


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

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

is there a way to avoid output body when a request is calling for a vhost that not exist?

tOmasEn December 05, 2009 12:32PM

Re: is there a way to avoid output body when a request is calling for a vhost that not exist?

Igor Sysoev December 05, 2009 12:56PM

Re: is there a way to avoid output body when a request is calling for a vhost that not exist?

tOmasEn December 05, 2009 11:42PM

Re: is there a way to avoid output body when a request is calling for a vhost that not exist?

Igor Sysoev December 06, 2009 04:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 255
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