redirect - nginx redirecting all traffic, not just server_name -
i'm using nginx reverse proxy several node servers. added ssl 1 of projects.
my config looks little this:
# domain1 server { listen 443 ssl; server_name *.domain1.com location / { proxy_pass http://123.456.789.012:3001; # ... other proxy stuff } } server { listen 80; server_name *.domain1.com; return 301 https://$host$request_uri; }
this works domain1. https works, , http redirects https.
however, has somehow affected another domain on same server. here's config:
# domain2 server { listen 80; server_name *.domain2.com; location / { proxy_pass http://123.456.789.012:3002; # ... other proxy stuff } }
what's happening is, when go http://domain2.com, redirected https://domain2.com, complains because don't have ssl certificate domain.
when remove second server block domain1, 1 forwards traffic on 80 https, domain2 works again.
it seems me nginx ignoring server_name
property, , forwarding traffic https. i've tried using hard urls well:
server_name domain1.com www.domain1.com
i'm trying pretty simple, there must obvious problem, can't see it!
as pointed out @grochmal, believe simple caching issue. switching 302 found redirects instead of 301s, , using new browser, able correct results.
i corrected wildcards, may have been original problem.
Comments
Post a Comment