TrOnNe
TrOnNe

Reputation: 1772

Isolate Laravel url to make it http while rest is https

Introduction:

Situation:

Problem:

Question:

Idea:

Ngnix conf for reference:

server {
   listen 80;
   listen [::]:80;
   server_name .example.com;
   root /home/forge/example.com/public;
   location /tpv {
       return 301 http://example.com/index.php/tpv;
   }
   location /index.php/tpv {
       return 301 http://example.com/index.php/tpv;
   }
   location / {  # the default location redirects to https
        return 301 https://$host$request_uri;
   }
}

Upvotes: 2

Views: 136

Answers (1)

Alberto rojas
Alberto rojas

Reputation: 191

Prior to the good ideas you've got, try this simple magic code in conf ;)

server {
   listen 80;
   listen [::]:80;
   server_name .example.com;
   root /home/forge/example.com/public;

   location ^~  /tpv* {
       return 301 https://$host$request_uri;
   }

   try_files $uri $uri/ /index.php?$query_string;

   location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

Upvotes: 1

Related Questions