Nginx redirect to main domain on SSL -
i have 2 equal domains, served virtual hosts, site.com , additional.com. have ssl cert first 1 , don't want another. when user trying log in, i'm doing permanent redirect:
server { listen 443; server_name additional.com; rewrite ^/(.*) https://site.com permanent; } ...
server { listen 80; server_name site.com additional.com; root /home/site/production/public; location / { ... } } server { listen 443; server_name site.com; ssl on; ... } and fails, since ssl traffic proxied uplink server, , cannot handle it, because talks http , there's ssl23_get_server_hello:unknown protocol (for chrome; firefix , curl have different error messages). had change (notice http, not https here):
server { listen 443; server_name additional.com; rewrite ^/(.*) http://site.com permanent; } errors no longer appear, when going /login page (that should secure , uplink redirects https) it's not rewriting, stating certificate invalid. if confirm security exception, redirected site.com landing page , need click on login link second time.
how set redirect https://additional.com/login point https://site.com correctly?
you need ssl certificate every step of journey if want redirect https https, i'm afraid. no way around - @ least kill errors.
that said... try rewrites:
rewrite ^/(.*) https://site.com/$1 permanent; this should keep path used.
Comments
Post a Comment