-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.conf
50 lines (40 loc) · 1.55 KB
/
default.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
# base on https://gist.github.com/thoop/8165802
server {
listen 9090 default_server;
client_max_body_size 10M;
server_name _;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_connect_timeout 1800;
proxy_send_timeout 1800;
proxy_read_timeout 1800;
send_timeout 1800;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
location ~* \.(?:manifest|html?|xml|json)$ {
expires -1;
proxy_pass ${BACKEND_URL}$request_uri;
}
location ~* \.(?:js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|svg|eot)$ {
proxy_pass ${BACKEND_URL};
}
location / {
set $renderman 0;
if ($http_user_agent ~* "googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|slack-imgproxy|slackbot-linkexpanding|vkshare|w3c_validator|whatsapp|collector-agent") {
set $renderman 1;
}
if ($renderman = 1) {
proxy_pass http://localhost:${PORT};
}
if ($renderman = 0) {
proxy_pass ${BACKEND_URL}$request_uri;
}
}
}