Nginx redirect issue

Discussion in 'ISPConfig 3 Priority Support' started by rst, Sep 15, 2016.

  1. rst

    rst New Member HowtoForge Supporter

    Hi guys,
    Not fully sure if this post belongs here. If not let me know :)

    I have a strange issue with Nginx redirect.
    I have a website running listening on a single IP that I chose from the dropdown list in the website tab of Ispconfig.
    With that setup the following redirect for enforcing https works:

    if ($ssl_protocol = "") {
      rewrite ^   https://$server_name$request_uri? permanent;
    However when I assign the website to listen to *, everything seems to work except for this rewrite rule.
    After some searching I still have no clue what's going on. Can you shed any light on this?

    (My use case for listening to multiple ip's: I have to move a site from one IP to the other, but would like the server to temporarily serve pages on both IP's untill I'm fully sure that the DNS change has been propagated worldwide)

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Normally this should work, I use it here with * as well for SSL sites and ssl redirects. Which http client (browser) do you use? There are some older clients that dont support sni for SSL, if a client does not support sni and you have several SSL websites on the same IP with *, then apache and nginx will show the first website that they find on the same IP as the browser did not send the domain name to resolve the request to the correct site.
  3. rst

    rst New Member HowtoForge Supporter

    Hi Till,
    I am using latest version of Chrome.
    The problem is not so much that it shows the site with the wrong security certificate, but that when I access a url over http, instead of redirection to the https version, I get a nginx 404 message. (sorry i should have specified this in a more clear way).
    Gives nginx 404:

    Kind regards,
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Does the 404 show up in the access.log of the correct website (which would indicate that nginx routed the request to the right vhost), or in the access.log of another website or the global access.log?

Share This Page