diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 60147299..a23fbde5 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -30,6 +30,7 @@ class Kernel extends HttpKernel */ protected $middlewareGroups = [ 'web' => [ + \App\Http\Middleware\ForceXForwardedProto::class, \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, diff --git a/app/Http/Middleware/ForceXForwardedProto.php b/app/Http/Middleware/ForceXForwardedProto.php new file mode 100644 index 00000000..5ab2a53e --- /dev/null +++ b/app/Http/Middleware/ForceXForwardedProto.php @@ -0,0 +1,19 @@ +header('X-Forwarded-Proto') === 'https') { + $request->server->set('HTTPS', 'on'); + } else { + $request->server->set('HTTPS', 'off'); + } + + return $next($request); + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d263f7be..aeb46500 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: "3.7" services: web: build: @@ -7,7 +7,7 @@ services: ports: - 80:80 depends_on: - mysql: + - "mysql": condition: service_healthy mysql: @@ -17,10 +17,10 @@ services: MYSQL_USER: 'deming_user' MYSQL_PASSWORD: 'demPasssword-123' MYSQL_ROOT_PASSWORD: 'root' - ports: - - "3306:3306" + expose: + - 3306 healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3306"] - interval: 3s - timeout: 60s - retries: 5 \ No newline at end of file + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$${MYSQL_ROOT_PASSWORD}"] + interval: 10s + timeout: 5s + retries: 3 \ No newline at end of file