# Server 1 redirects, Server 2 does not

**URL:** <https://www.ruby-forum.com/t/server-1-redirects-server-2-does-not/243101>\
**Category:** NGINX\
**Created:** [August 21, 2015, 4:36am UTC](https://www.ruby-forum.com/t/server-1-redirects-server-2-does-not/243101 "2015-08-21T04:36:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 21, 2015, 4:36am UTC](https://www.ruby-forum.com/t/server-1-redirects-server-2-does-not/243101/1 "2015-08-21T04:36:22Z")

</div>

This problem may have been around before I updated to nginx version  
1.9.4  
but I’m not sure.

I have one VPS with two IP addresses. Server 1 redirects port 80 www and  
non-www to port 443 requests along with www requests on port 443 to the  
non-www web site. iow, http://(www.)[site1.com/](http://site1.com/) and  
[https://www.site1.com/](https://www.site1.com/)  
properly get 301 redirected to https:site1.com/

Site 2 does not do this and only redirects http:// requests to the  
equivalent https:// even though both server directives contain identical  
directives though different ssl certs.

server {  
listen xxx.xxx.21.234:80;  
server\_name [www.site1.com](http://www.site1.com) [site1.com](http://site1.com);  
return 301 https://site1.com$request\_uri;  
}

```
server {
    listen xxx.xxx.21.234:443 ssl http2;
    server_name site1.com;

    http2_keepalive_timeout 64;
    keepalive_timeout 64;

```

…

This is identical for server 2 including the rest of the directives in  
the  
server block. My one question is whether the ssl cert for server2 may  
not be  
properly set up for the www name but I’m not sure.

Does something immediately jump out as the problem or where should I  
look  
further? Other than the redirection, everything on server2 works as it  
should.

Posted at Nginx Forum:

> **[Server 1 redirects, Server 2 does not](https://forum.nginx.org/read.php?2,261156,261156#msg-261156)**
>
> This problem may have been around before I updated to nginx version 1.9.4 but I'm not sure. I have one VPS with two IP addresses. Server 1 redirects port 80 www and non-www to port 443 requests along with www requests on port 443 to the non-www web...

---

<div class="post-metadata">

**Author:** ![drhowarddrfine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/59ef9b/32.png) [@drhowarddrfine](https://www.ruby-forum.com/u/drhowarddrfine)\
**Post date:** [August 21, 2015, 4:37am UTC](https://www.ruby-forum.com/t/server-1-redirects-server-2-does-not/243101/2 "2015-08-21T04:37:32Z")

</div>

Note that I upgraded the server so I could turn httpv2 on.

Posted at Nginx Forum:

> **[Re: Server 1 redirects, Server 2 does not](https://forum.nginx.org/read.php?2,261156,261157#msg-261157)**
>
> This problem may have been around before I updated to nginx version 1.9.4 but I'm not sure. I have one VPS with two IP addresses. Server 1 redirects port 80 www and non-www to port 443 requests along with www requests on port 443 to the non-www web...

---

<div class="post-metadata">

**Author:** ![drhowarddrfine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/59ef9b/32.png) [@drhowarddrfine](https://www.ruby-forum.com/u/drhowarddrfine)\
**Post date:** [August 21, 2015, 5:10am UTC](https://www.ruby-forum.com/t/server-1-redirects-server-2-does-not/243101/3 "2015-08-21T05:10:16Z")

</div>

Doing a curl -I -L [http://www.site1.com/](http://www.site1.com/) returns this:

HTTP/1.1 301 Moved Permanently  
Server: nginx  
Date: Fri, 21 Aug 2015 03:04:50 GMT  
Content-Type: text/html  
Content-Length: 178  
Connection: keep-alive  
Location: [https://site1.com/](https://site1.com/)

HTTP/1.1 200 OK  
Server: nginx  
Date: Fri, 21 Aug 2015 03:04:50 GMT  
Content-Type: text/html; charset=utf-8

Now I’m really confused. Using Chrome on my desktop and my phone, the  
address bar shows [https://www.site1.com](https://www.site1.com)

Posted at Nginx Forum:

> **[Re: Server 1 redirects, Server 2 does not](https://forum.nginx.org/read.php?2,261156,261159#msg-261159)**
>
> This problem may have been around before I updated to nginx version 1.9.4 but I'm not sure. I have one VPS with two IP addresses. Server 1 redirects port 80 www and non-www to port 443 requests along with www requests on port 443 to the non-www web...
