-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-nginx.conf
41 lines (36 loc) · 1.45 KB
/
docker-nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# In Dockerfile, this will replace /etc/nginx/conf.d/default.conf
server {
listen 80;
listen [::]:80;
server_name localhost;
# Ensure that Nginx will not rewrite the double slashes in `https://`, like in:
# /proxy/https://example.com/a/b/c
# ...to become a single slash:
# /proxy/https:/example.com/a/b/c
# In `proxy_pass` below, the above would eventually throw:
# invalid URL prefix in "https:/example.com/a/b/c"
# Note that, when specified in `server`, this only works for the default server;
# see https://nginx.org/en/docs/http/ngx_http_core_module.html#merge_slashes
merge_slashes off;
location / {
root /usr/share/nginx/html;
# Forward all non-existing paths, such as /configuration and /search, to the app
try_files $uri $uri/ /index.html;
}
location ~ /proxy/(?<target>.+) {
# Proxy requests for:
# /proxy/https://example.com/a/b/c
# ...to:
# https://example.com/a/b/c
proxy_pass $target;
# When not using a static target, a resolver is needed, for otherwise Nginx throws:
# no resolver defined to resolve <target name>
# Use Cloudflare DNS; https://www.cloudflare.com/learning/dns/what-is-1.1.1.1/
resolver 1.1.1.1;
}
# Redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}