Merge pull request #736 from acelaya-forks/feature/mercure-proxy

Configured an nginx container acting as a reverse proxy for the mercu…
This commit is contained in:
Alejandro Celaya 2020-04-25 13:56:07 +02:00 committed by GitHub
commit e95abc4efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 3 deletions

View File

@ -5,8 +5,8 @@ declare(strict_types=1);
return [
'mercure' => [
'public_hub_url' => 'http://localhost:3080',
'internal_hub_url' => 'http://shlink_mercure',
'public_hub_url' => 'http://localhost:8001',
'internal_hub_url' => 'http://shlink_mercure_proxy',
'jwt_secret' => 'mercure_jwt_key',
],

View File

@ -0,0 +1,17 @@
server {
listen 80 default_server;
error_log /home/shlink/www/data/infra/nginx/mercure_proxy.error.log;
location / {
proxy_pass http://shlink_mercure;
proxy_read_timeout 24h;
proxy_http_version 1.1;
proxy_set_header Connection "";
## Be sure to set USE_FORWARDED_HEADERS=1 to allow the hub to use those headers ##
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

View File

@ -3,7 +3,7 @@ version: '3'
services:
shlink_nginx:
container_name: shlink_nginx
image: nginx:1.17.6-alpine
image: nginx:1.17.10-alpine
ports:
- "8000:80"
volumes:
@ -28,6 +28,7 @@ services:
- shlink_db_ms
- shlink_redis
- shlink_mercure
- shlink_mercure_proxy
environment:
LC_ALL: C
@ -49,6 +50,7 @@ services:
- shlink_db_ms
- shlink_redis
- shlink_mercure
- shlink_mercure_proxy
environment:
LC_ALL: C
@ -105,6 +107,17 @@ services:
ports:
- "6380:6379"
shlink_mercure_proxy:
container_name: shlink_mercure_proxy
image: nginx:1.17.10-alpine
ports:
- "8001:80"
volumes:
- ./:/home/shlink/www
- ./data/infra/mercure_proxy_vhost.conf:/etc/nginx/conf.d/default.conf
links:
- shlink_mercure
shlink_mercure:
container_name: shlink_mercure
image: dunglas/mercure:v0.8
@ -113,3 +126,4 @@ services:
environment:
CORS_ALLOWED_ORIGINS: "*"
JWT_KEY: "mercure_jwt_key"
USE_FORWARDED_HEADERS: "1"