This repository was archived by the owner on Jan 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ environment variables is used in this image:
33
33
* ` PROXY_PORT ` : Port of the service to proxy
34
34
* ` PROXY_PROTOCOL ` : Protofol to the service to proxy (` http ` or ` https ` )
35
35
36
+ * ` ADD_HOST_HEADER ` : pass the proxy host header downstream (` true ` or ` false ` )
37
+
36
38
```
37
39
docker run \
38
40
-e OID_DISCOVERY=https://my-auth-server/auth \
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ env OIDC_RENEW_ACCESS_TOKEN_ON_EXPIERY;
19
19
env PROXY_HOST;
20
20
env PROXY_PORT;
21
21
env PROXY_PROTOCOL;
22
+ env ADD_HOST_HEADER;
22
23
23
24
events {
24
25
worker_connections 1024 ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ server {
11
11
set_by_lua $proxy_host 'return os.getenv("PROXY_HOST")';
12
12
set_by_lua $proxy_port 'return os.getenv("PROXY_PORT")';
13
13
set_by_lua $proxy_protocol 'return os.getenv("PROXY_PROTOCOL")';
14
+ set_by_lua $add_host_header 'return os.getenv("ADD_HOST_HEADER")';
14
15
15
16
error_log /dev/stdout notice;
16
17
@@ -25,7 +26,13 @@ server {
25
26
location / {
26
27
access_by_lua_file lua/auth.lua;
27
28
28
- proxy_set_header Host $http_host;
29
+ set $reverse_proxy_host $proxy_host;
30
+
31
+ if ($add_host_header = "true") {
32
+ set $reverse_proxy_host $http_host;
33
+ }
34
+
35
+ proxy_set_header Host $reverse_proxy_host;
29
36
proxy_pass $proxy_protocol://$proxy_host:$proxy_port;
30
37
}
31
38
You can’t perform that action at this time.
0 commit comments