I'm having some trouble redirecting https requests to my Nginx server when the only the short hostname of the server is used. I tried all combination of examples out there but nothing seems to trigger a redirect/rewrite.
For instance, the server is called web01, and I want all requests to go to https://web01.domain.com. I have the http -> https rewrite working perfectly to the FQDN. However, if I try to go to https://web01, it will proceed try and load the page and obviously error on certificate mismatch. I want it to rewrite the request to the FQDN. How can I configure the rewrite/redirect?
What I have now:
server {
listen *:80;
rewrite ^ https://web01.domain.com$request_uri permanent;
}
server {
listen 443 default ssl;
server_name web01.domain.com;
}
rewrite
destination, at least withpermanent
andtemporary
(301/302) redirects.