title: django ALLOWED_HOSTS redirects to a local ip
body: <p>My project runs when I set debug=True.
  When I set debug to False and ALLOWED_HOSTS to ['*'] it redirect me to the local IP my gunicorn is running on.</p>
  
  <p>When I set ALLOWED_HOSTS to my domain I get Server Error (500)</p>
  
  <p>Any suggestions?</p>
  
  <p>UPDATE:</p>
  
  <p>My problem was in nginx configuration, I had to set the host. I added the following to the configuration file and it worked.</p>
  
  <blockquote>
  <pre><code>          proxy_set_header X_FORWARDED_PROTO https;
            proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header  Host mysite.com;
            proxy_set_header  X-Url-Scheme $scheme;
            proxy_redirect    off;
            proxy_max_temp_file_size 0;
  </code></pre>
  </blockquote>