Double Redirect

Francis Daly francis at daoine.org
Sun Jun 19 23:14:44 UTC 2016


On Sun, Jun 19, 2016 at 05:12:27PM -0400, Lebod wrote:

Hi there,

> I'm having an issue with our site. We're trying to redirect all traffic of
> http://example.com to https://www.example.com.
> Testing out our site, what happens is that http://example.com redirects to
> https://example.com which then redirects to https://www.example.com
> 
> We also get an error:
> nginx -t
> nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored

That suggests that there is another server{} block in, or included in,
your nginx.conf that you have not shown here.

> server {
>     listen 80;
>     listen 443 ssl;
>     server_name example.com ***IP Address***;
>     return 301 https://www.example.com$request_uri;
> }

If http://example.com redirects to https://example.com, then that server{}
is not used for the http://example.com request.

> I was wondering if there was an issue in our setup that's causing the double
> redirect and the error:
> nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored

nginx -T

might show you where the problem is.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list