NGINX - Rewrite HTTP to HTTPS

Discussion in 'Feature Requests' started by CTS_AE, May 24, 2017.

  1. CTS_AE

    CTS_AE New Member

    I've seen multiple times especially on the forums here to use something like this:
    https://www.howtoforge.com/community/threads/http-redirect-https-nginx-ispconfig3.68819/
    Code:
    if ($scheme != "https") {
    rewrite ^ https://www.howtoforge.com$request_uri? permanent;
    }
    Although documentation is against the method above: https://www.nginx.com/blog/creating-nginx-rewrite-rules#https

    Could the recommended method be implemented for NGINX?
    The checkbox already exists for Website > Redirect Tab > Rewrite HTTP to HTTPS
    But the checkbox doesn't seem to function properly for NGINX
    Code:
    server {
        listen 80;
        server_name www.domain.com;
        return 301 https://www.domain.com$request_uri;
    }
    Not sure if the domain can be generic/dynamic, or how this works with aliases?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The checkbox works fine on all my nginx systems with the current implementation. The other way is already implemented as well, see git master branch, but you won't see any difference compared to the current implementation, at least when you dont run a really big system which serves hundred millions of impressions.
     
    CTS_AE likes this.
  3. CTS_AE

    CTS_AE New Member

    Not sure what's up but it does seem to be working!
    Maybe I was being impatient - even though we have our red notification bubble now and I'm fairly certain I waited last time.
     

Share This Page