0

My site uses both www and non-www addresses for our site (dcturano.com). The problem I'm having is that the server is redirecting non-www traffic to www traffic. How do I prevent this?

server {
    listen 80;
    listen [::]:80;
    listen 443 default_server ssl;

    server_name dcturano.com www.dcturano.com;

    if ($scheme = http) {
            return 301 https://$server_name$request_uri;
    }
}
3
  • 1
    Figure out what's doing it. It doesn't appear to be this bit of configuration. Check your application and any other layers you have in front of it. Dec 5, 2014 at 0:35
  • 1
    Is there anything setting server_name_in_redirect to on? My understanding is that would cause this behaviour. Dec 5, 2014 at 0:48
  • You should really be using two server blocks for the example in the question. I.e. one for http, which unconditionally redirects, and one for https which does not.
    – AD7six
    Dec 5, 2014 at 8:30

0

You must log in to answer this question.

Browse other questions tagged .