2021-09-15 09:50:51 +00:00
|
|
|
{{ $port_map := .PROXY_PORT_MAP | split " " }}
|
|
|
|
{{ $port_map_list := index $port_map 0 | split ":" }}
|
2021-09-15 08:56:01 +00:00
|
|
|
{{ $scheme := index $port_map_list 0 }}
|
|
|
|
{{ $listen_port := index $port_map_list 1 }}
|
|
|
|
{{ $upstream_port := index $port_map_list 2 }}
|
|
|
|
|
2021-09-15 09:55:15 +00:00
|
|
|
{{ $listeners := $.DOKKU_APP_WEB_LISTENERS | split " " }}
|
|
|
|
{{ $listener_list := index $listeners 0 | split ":" }}
|
2021-09-15 09:50:51 +00:00
|
|
|
{{ $listener_ip := index $listener_list 0 }}
|
|
|
|
|
|
|
|
location /graphql {
|
2021-09-15 08:56:01 +00:00
|
|
|
|
2022-01-06 13:59:44 +00:00
|
|
|
rewrite ^/graphql/(.*) /$1 break;
|
2021-11-10 14:10:59 +00:00
|
|
|
|
2021-09-15 08:56:01 +00:00
|
|
|
gzip on;
|
|
|
|
gzip_min_length 1100;
|
|
|
|
gzip_buffers 4 32k;
|
|
|
|
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
|
|
|
|
gzip_vary on;
|
|
|
|
gzip_comp_level 6;
|
|
|
|
|
2021-09-15 09:50:51 +00:00
|
|
|
proxy_pass http://{{ $listener_ip }}:{{ $upstream_port }};
|
2021-09-15 08:56:01 +00:00
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_read_timeout {{ $.PROXY_READ_TIMEOUT }};
|
|
|
|
proxy_buffer_size {{ $.PROXY_BUFFER_SIZE }};
|
|
|
|
proxy_buffering {{ $.PROXY_BUFFERING }};
|
|
|
|
proxy_buffers {{ $.PROXY_BUFFERS }};
|
|
|
|
proxy_busy_buffers_size {{ $.PROXY_BUSY_BUFFERS_SIZE }};
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection $http_connection;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Forwarded-For {{ $.PROXY_X_FORWARDED_FOR }};
|
|
|
|
proxy_set_header X-Forwarded-Port {{ $.PROXY_X_FORWARDED_PORT }};
|
|
|
|
proxy_set_header X-Forwarded-Proto {{ $.PROXY_X_FORWARDED_PROTO }};
|
|
|
|
proxy_set_header X-Request-Start $msec;
|
2022-01-06 13:59:44 +00:00
|
|
|
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
|
|
|
#
|
|
|
|
# Custom headers and headers various browsers *should* be OK with but aren't
|
|
|
|
#
|
|
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
|
|
|
#
|
|
|
|
# Tell client that this pre-flight info is valid for 20 days
|
|
|
|
#
|
|
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
|
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
|
|
add_header 'Content-Length' 0;
|
|
|
|
return 204;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_method = 'POST') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
|
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
|
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_method = 'GET') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
|
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
|
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
|
|
|
}
|
2021-11-10 14:10:59 +00:00
|
|
|
}
|