redirection problem with ssl

Solved Technical Support
  • hello,

    my site redirect ;
    http://mydomain.com to https://mydomain.com GOOD
    http://www.mydomain.com to https://mydomain.com GOOD

    but DO NOT redirect
    https://www.mydomain.com to https://mydomain.com NOT GOOD

    it stays as https://www.mydomain.com

    my default /etc/nginx/sites-enabled/default is ;

    listen 80;
     server_name mydomain.com www.mydomain.com;
     return 301 https://$host$request_uri;
    }
    server {
     listen 443 ssl;
     server_name mydomain.com www.mydomain.com;
     ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
     location / {
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header Host $http_host;
     proxy_set_header X-NginX-Proxy true;
     proxy_pass http://1.1.1.1.1.1.1.3:4567/;
     proxy_redirect off;
     #Socket.IO Support
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
     }
     location ~ /.well-known {
     allow all;
     }
    }
    
    any idea pleaase.
    
    thank you in advance.
  • @atozsoft said in redirection problem with ssl:

    hello,

    my site redirect ;
    http://mydomain.com to https://mydomain.com GOOD
    http://www.mydomain.com to https://mydomain.com GOOD

    but DO NOT redirect
    https://www.mydomain.com to https://mydomain.com NOT GOOD

    it stays as https://www.mydomain.com

    my default /etc/nginx/sites-enabled/default is ;

    listen 80;
     server_name mydomain.com www.mydomain.com;
     return 301 https://$host$request_uri;
    }
    server {
     listen 443 ssl;
     server_name mydomain.com www.mydomain.com;
     ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
     location / {
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header Host $http_host;
     proxy_set_header X-NginX-Proxy true;
     proxy_pass http://1.1.1.1.1.1.1.3:4567/;
     proxy_redirect off;
     #Socket.IO Support
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
     }
     location ~ /.well-known {
     allow all;
     }
    }
    
    any idea pleaase.
    
    thank you in advance.
    

    Make a second Block for 443 that does a redirect like port 80 except specifically redirect it to https://domain.com$request_uri Instead of https://$host$request_uri

    Only put in the www.domain.com server.

    Take the www.domain.com out of the existing 443 block.

    I assume (never tested this) that the new 443 block will need the SSL settings.

  • thank you @JaredBusch

    i tried but got error. site did not load.

  • Fixed by adding

    if ($host = www.$server_name) {
    rewrite ^(.*) https://$server_name$request_uri? permanent;
    }

    after

    proxy_set_header Connection "upgrade";
    }

    line.


Suggested Topics


  • 0 Votes
    6 Posts
    391 Views

    I was fix problem.

  • 0 Votes
    14 Posts
    946 Views

    I will notify the plugin's creator, thank you.

  • 0 Votes
    6 Posts
    872 Views

    one more thing I found, at the Uploads section on the admin, I get the following error:

    Error: ENOENT: no such file or directory, scandir '/public/uploads'

    although I do have that library, if I do

    ls public/

    while I am at the root of the forum, it does list the folder:

    503.html favicon.ico images js-enabled.css language less logo.png src uploads vendor
  • 0 Votes
    1 Posts
    745 Views

    Hey,
    I have a problem after updating my forum to version 1.4.5 (from 1.4.2)
    The Problem is user cant login to there account.

    nodebb LOG:
    17/3 12:47:48 [21825] - warn: [deprecated] Accessing stylesheet.css from / is deprecated. Use /assets/stylesheet.css to access this file.
    17/3 12:47:48 [21825] - warn: [deprecated] Accessing nodebb.min.js from / is deprecated. Use /assets/nodebb.min.js to access this file.
    17/3 16:22:13 [21825] - warn: [deprecated] Accessing stylesheet.css from / is deprecated. Use /assets/stylesheet.css to access this file.
    17/3 16:22:13 [21825] - warn: [deprecated] Accessing nodebb.min.js from / is deprecated. Use /assets/nodebb.min.js to access this file.
    17/3 16:24:33 [21825] - warn: [deprecated] Accessing vendor/fontawesome/fonts/fontawesome-webfont.woff2 from / is deprecated. Use /assets/vendor/fontawesome/fonts/fontawesome-webfont.woff2 to access this file.
    17/3 16:24:58 [21825] - error: /login
    invalid csrf token

    Chrome DEV Log: WebSocket connection to 'wss://showgaming.de/socket.io/?EIO=3&transport=websocket&sid=theid....' failed: Error during WebSocket handshake: Unexpected response code: 404

    When you are already logged in evrything works fine, else comes a session expired invalide csrf token by login.
    I hope someone can help me with that problem,
    Have a nice day,
    Ezamik

  • 0 Votes
    12 Posts
    2k Views

    @djcyry Under ACP -> Settings -> General change site title