Skip to content

Commit

Permalink
Merge pull request #52 from pdurandfr/main
Browse files Browse the repository at this point in the history
Docker-compose behind https reverse-proxy
  • Loading branch information
dbarzin authored Sep 19, 2023
2 parents bae4d53 + 16fa543 commit 799c256
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions app/Http/Middleware/ForceXForwardedProto.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Middleware;

use Closure;

class ForceXForwardedProto
{
public function handle($request, Closure $next)
{
if ($request->header('X-Forwarded-Proto') === 'https') {
$request->server->set('HTTPS', 'on');
} else {
$request->server->set('HTTPS', 'off');
}

return $next($request);
}
}
16 changes: 8 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.7"
services:
web:
build:
Expand All @@ -7,7 +7,7 @@ services:
ports:
- 80:80
depends_on:
mysql:
- "mysql":
condition: service_healthy

mysql:
Expand All @@ -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
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$${MYSQL_ROOT_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 3

0 comments on commit 799c256

Please sign in to comment.