From 70ecf3bf9b1fef949ae79687af97571e6ce9a14d Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Wed, 24 Aug 2022 22:26:20 +0000 Subject: [PATCH] Add container port number as an environment variable --- Dockerfile | 1 + README.md | 1 + director.conf | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 252b29c..e40eb6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM nginx:alpine ENV LISTEN_PORT="80" ENV CONTAINER_PREFIX="container" +ENV CONTAINER_PORT="80" ENV SPAWNER_HOST="spawner" ENV SPANWER_PORT="80" diff --git a/README.md b/README.md index 0d1aeb1..0e4394c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ services: environment: LISTEN_PORT: 80 CONTAINER_PREFIX: "container" + CONTAINER_PORT: 80 SPAWNER_HOST: "spawner" SPANWER_PORT: 80 ... diff --git a/director.conf b/director.conf index 967053d..e521b81 100644 --- a/director.conf +++ b/director.conf @@ -5,7 +5,7 @@ server { resolver 127.0.0.11 valid=1s; location / { - proxy_pass http://${CONTAINER_PREFIX}$http_x_forwarded_preferred_username$uri; + proxy_pass http://${CONTAINER_PREFIX}$http_x_forwarded_preferred_username:${CONTAINER_PORT}$uri; error_page 502 = @spawner; }