Skip to content

Commit e080e92

Browse files
Add support for HTTPS backends
1 parent d9fff6d commit e080e92

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN chmod 755 /*.sh
1616

1717
# Set reverse proxy domain
1818
ENV REVERSE_DOMAIN example.com
19+
ENV REVERSE_PROTO http
1920

2021
# Expose and start
2122
EXPOSE 80

nginx.conf

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ http {
1313
listen 80;
1414

1515
location / {
16-
proxy_pass http://_REPLACE_ME_/;
17-
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404 http_403 http_300 http_301 http_303;
16+
proxy_pass _REPLACE_ME_PROTO_://_REPLACE_ME_HOST_/;
17+
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_403 http_404;
1818
proxy_redirect off;
1919
proxy_buffering off;
20-
proxy_set_header Host _REPLACE_ME_;
20+
proxy_set_header Host _REPLACE_ME_HOST_;
2121
proxy_set_header X-Real-IP $remote_addr;
2222
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
23+
proxy_intercept_errors on;
2324
}
2425
}
2526
}

run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22

33
echo "Configuring Nginx Reverse Proxy..."
4-
sed -i "s/_REPLACE_ME_/$REVERSE_DOMAIN/g" /etc/nginx/nginx.conf
4+
sed -i "s/_REPLACE_ME_HOST_/$REVERSE_DOMAIN/g" /etc/nginx/nginx.conf
5+
sed -i "s/_REPLACE_ME_PROTO_/$REVERSE_PROTO/g" /etc/nginx/nginx.conf
56

67
echo "Starting Nginx Reverse Proxy..."
78
exec /usr/sbin/nginx & tail -F /var/log/nginx/*

0 commit comments

Comments
 (0)