-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrevprox.conf
54 lines (44 loc) · 1.52 KB
/
revprox.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
42
43
44
45
46
47
48
49
50
51
52
53
54
# Map HTTP Forwarded header to a variable we can assign to $backend_url
map $http_forwarded $backend_url {
default "";
"~*for=([^;]+);" $1;
}
#Resetting variables
js_import headers.js;
js_set $headers_json headers.headers_json;
#Build the main log_format...again
log_format main '$remote_addr'
'\t$remote_user'
'\t$time_local'
'\t$request'
'\t$status'
'\t$body_bytes_sent'
'\t$headers_json';
# Configures a reverse proxy server that passes the $backend_url variable containing HTTP Forwarded header info as the backend server address
server {
listen 80;
listen 443 ssl;
#
access_log /var/log/nginx/logs/server_access.log main;
error_log /var/log/nginx/logs/server_error.log;
# SSL/TLS configuration
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
#Plain old proxy pass to my CloudFlare server
location / {
proxy_pass https://domainfronter.pages.dev/;
}
#URI wildcard handles all requests
location /revprox {
#Passes the Forwarded header for contents to the reverse proxy as the new destination
proxy_set_header Host $backend_url;
#Enable javascript logging functions
js_header_filter headers.headers_json_log;
}
#Serve a front page to confirm web server is running
location /test {
root /usr/share/nginx/html;
}
# Configures the error page
error_page 400 /400.html;
}