Freedo asked:
I have a script that is out of my control, that creates links that redirect to my server IP but with https://
on it.
This obviously create issues with the certificate. I can redirect my ip
to http://domain
fine but I can’t make ip
> https://domain
work?
server {
listen 80;
server_name 192.168.0.1;
return 301 $scheme://example.com$request_uri;
}
server {
listen 443 ssl;
server_name 192.168.0.1;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
return 301 https://example.com$request_uri;
}
After that block I have another server {}
listening on port 80
and 443
but with server_name
using my domain if that matters.
I redacted my IP’s obviously I’m using real IP’s in my configuration file
My answer:
You can’t get a TLS certificate for an IP address that browsers will recognize. You will have to fix the script which generates the inappropriate redirects. That actually is possible.
View the full question and any other answers on Server Fault.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.