So I’ve been using a domain example.com in a lot of ports, like 444, 445, 446…
And now I use redirect in my DNS provider so the traffic should come from port 443 to the other ports, because the redirects are web1.example.com to example.com:444
As the default port is 443 this should happen.
Everything works, but when the user tries to use www.web1.example.com it always led the user to the first domain in my nginx config file, something that shouldn’t happen.
I was researching and learned about CORS so my question is: How can I make a redirect from port 443 work when sending the user to another port on the same domain?
I tried redirecting the user using a DNS provider, but when the user uses www it always send the then to the first domain configured in my NGINX.conf file, tried to redirect traffic with www coming from all the ports I have configured to non-www, but it didn’t work for this I used this config:
if ($host ~ ^www.example.com.$) { set $target_port 444; return 301 https://jretailstore.com.br:$target_port; }