← Blog

Laravel and Nginx letsencrypt

1 minEN

Laravel and Nginx letsencrypt

Good morning, everybody,
By necessity I found myself having to configure a docker solution with Nginx as a reverse proxy HTTPS and a container with a Laravel solution all protected by Cloudflare.
Up to now everything was fine in the sense that with Cloudflare that forced from HTTP to HTTPS there was no mixed content problem.
The problem arose when it came to the need to access the machine via internal LAN network.
Here I started having browser-side mixed content problems and many things were blocked with various insecure content errors.


The solution after several searches was to intervene on the Laravel configuration side in this way:

Edit AppServiceProvider.php

public function register() { $this->app['request']->server->set('HTTPS', true); }

References:

Force SSL Secure Routes in Laravel 5.2
I was looking for information on how to make all my routes redirect to SSL. I came across the following. http://www.jeffmould.com/2016/01/31/laravel-...
nginx-proxy/nginx-proxy
Automated nginx proxy for Docker containers using docker-gen - nginx-proxy/nginx-proxy
JrCs/docker-letsencrypt-nginx-proxy-companion
LetsEncrypt companion container for nginx-proxy. Contribute to JrCs/docker-letsencrypt-nginx-proxy-companion development by creating an account on GitHub.