Welcome! Log In Create A New Profile

Advanced

Re: Help with code

Jan Algermissen
July 22, 2013 12:12PM
On 22.07.2013, at 17:39, Nick Toseland <nick@livejournalinc.com> wrote:

> Hi All,
>
> I have the following code:
>
> location = /favicon.ico {
> if ($host = "abc.com"){
> return 301 "http://www.abc.com/favicon.ico";
> }
> }
>
> If I make a request to abc.com/favicon.ico I get a 301 and then a 200 OK
>
> However the issue is that if I make a request to xyz.abc.com/favicon.ico I get a 404 as it passes the first match statement but fails the second and trys to get the favicon resource from the nginx root directory

Why should the check process even go inside the if, given that xyz.abc.com is not host abc.com?

Jan

>
> Is there a better way of doing it so it continues on to be evaluated by the other rules? or Is there a better way of writing this part of the code?
>
> Thanks in advance.
>
> Nick
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

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

Help with code

Nick Toseland July 22, 2013 11:40AM

Re: Help with code

Jan Algermissen July 22, 2013 12:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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