Laravel 5 and Cloudflare SSL -


well, today first time decided use ssl on web project. firstly, configured domain in cloudflare.com. turned on page rules in cloudflare, automatic redirect website https.

http://*example.com/* 

to make sure works, added simple index.php public_html , worked. mean, when entered web site, https active , site displayed me famous word: "hello world"

after uploaded laravel project web server , configured virtual host. use nginx server.

server {         listen 80;          root /home/user/www/example.com/public_html/public;         index index.php index.html index.htm;          server_name example.com          location / {                 try_files $uri $uri/ =404;         }          error_page 404 /404.html;         error_page 500 502 503 504 /50x.html;          location = /50x.html {                 root /usr/share/nginx/html;         }          location ~ \.php$ {                 try_files $uri =404;                 fastcgi_split_path_info ^(.+\.php)(/.+)$;                 fastcgi_pass unix:/var/run/php5-fpm.sock;                 fastcgi_index index.php;                 fastcgi_param script_filename $document_root$fastcgi_script_nam$                 include fastcgi_params;         } } 

well, when enter website https, laravel routes don't work. also, css , js files weren't read server.

then turned off page rules cloudflare, site worked http.

i tried configure server listen 443, used ssl on command, wasn't result.

also, found link cloudflare laravel 5. not sure, that, want.

laravel cloudflare

any help, appreciated.

solution

forcing routes https decided make middleware , use in routes.

namespace app\http\middleware;  use closure;  class httpsprotocol {     public function handle($request, closure $next)     {         $request->settrustedproxies( [ $request->getclientip() ] );         if (!$request->secure()) {             return redirect()->secure($request->getrequesturi());         }          return $next($request);     } } 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -