nginx-proxy: nginx-proxy doesn't https 301 auto redirect
I’m facing weird issue, all other sites are properly redirected with 301 via nginx-proxy. but 1 domain returns 200 instead of 301.
curl -k --head portfolio.sandrophoto.com
HTTP/1.1 200 OK
Server: nginx/1.9.12
Date: Tue, 17 May 2016 12:36:49 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.6.21
X-Pingback: https://portfolio.sandrophoto.com/xmlrpc.php
curl -k --head sandrophoto.com
HTTP/1.1 301 Moved Permanently
Server: nginx/1.9.12
Date: Tue, 17 May 2016 12:37:15 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: https://sandrophoto.com/
VIRTUAL_HOST: |
sandrophoto.com,
www.sandrophoto.com,
portfolio.sandrophoto.com
LETSENCRYPT_HOST: |
sandrophoto.com,
portfolio.sandrophoto.com
I don’t see anything alarming in logs neither of nginx-proxy nor the nginx-webserver. Is there any reason why it would fail redirect?
btw, going to https directly works fine, so ssl keys are generated and ready.
p.s. redirect atm is done via php, this is why I’m checking headers with curl. something seems off.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (2 by maintainers)
Perhaps
nginx-proxydoesn’t realize that the SSL certificate (presumably*.sandrophoto.com) should be used forportfolio.sandrophoto.com, and so it does not do the HTTPS redirect, although if that is true it would be a bug innginx-proxysince you said that HTTPS does indeed work throughnginx-proxywhen you go there directly. You could try addCERT_NAME=sandrophoto.comto the env vars ofwebserverto force it to use that certificate (assuming the cert issandrophoto.com.<crt|.key>). Since the nginx config you posted forportfolio.sandrophoto.comdoes not contain an SSL section, I would be curious to see if that is a wildcard cert or if it is just forsandrophoto.com, or if it hasportfolio.sandrophoto.comas an alternate name.