nginx redirect multiple servers to SSL -


i have code. want each of server_name in list redirect own name https. but, if http://beta.example.com, redirects https://api.example.com (or whatever first item in list is)

server {     listen         80;     server_name    api.example.com beta.example.com apibeta.example.com nodebeta.example.com app.example.com;     return         301 https://$server_name$request_uri; } 

you should able use $host variable instead:

server {     listen         80;     server_name    api.example.com beta.example.com apibeta.example.com nodebeta.example.com app.example.com;     return         301 https://$host$request_uri; } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -