1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Nginx redirect double backlash issues.

Discussion in 'Server Configuration and Hosting' started by rainmotorsports, Jan 24, 2016.

  1. rainmotorsports

    rainmotorsports Well-Known Member

    Perhaps its not a big deal as I don't have any previous url's to be forwarded. But if i go to say http://www.raindd.com the redirect comes out https://www.raindigital.design// or //media/ for example if i had done media on the original url.

    The non https origin redirect is this:
    Code:
     server {
                    listen 80;
                    listen [::]:80;
                    server_name raindd.com www.raindd.com raindigitaldesign.com www.raindigitaldesign.com raindigital.design www.raindigital.design;
                    return 301 https://www.raindigital.design/$request_uri;
            }
    
    Here is the destination vhost config sans some of the ssl:
    Code:
    server {
                    listen 443 ssl http2;
                    listen [::]:443 ssl http2;
                    server_name www.raindigital.design;
                    ssl on;
                    ssl_prefer_server_ciphers on;
                    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:!ADH:!AECDH:!MD5;
                    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                    ssl_stapling on;
                    ssl_stapling_verify on;
                    add_header Strict-Transport-Security max-age=63072000;
                    add_header X-Frame-Options SAMEORIGIN;
                    add_header X-Content-Type-Options nosniff;
    
                    root /home/rainddweb/domains/raindigital.design/public_html;
    
                    location /(data|internal_data|library)/ {
                            allow 127.0.0.1;
                            deny all;
                    }
    
                    location / {
                            try_files $uri $uri/ /index.php?$uri&$args;
                            index index.php index.html;
                    }
    
                    location ~ \.php$ {
                            fastcgi_split_path_info ^(.+\.php)(/.+)$;
                            include fastcgi_params;
                            fastcgi_index index.php;
                            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                            fastcgi_pass unix:/var/run/php-fpm/rainddweb.sock;
                    }
    
            }
    
    Any clue how to prevent it?
     
  2. RoldanLT

    RoldanLT Well-Known Member

    Code:
    server {
                    listen 80;
                    listen [::]:80;
                    server_name raindd.com www.raindd.com raindigitaldesign.com www.raindigitaldesign.com raindigital.design www.raindigital.design;
                    return 301 https://www.raindigital.design$request_uri;
            }
    Try that.
     
  3. rainmotorsports

    rainmotorsports Well-Known Member

    Oops I forgot last time i tried this i was tracking down an issue i had with php-fpm and when i had tried it made things worse but it was completely unrelated. Never thought to try again now. Thanks.
     

Share This Page