Solution for the Background requests that takes more than 60s to complete
files: | |
/etc/nginx/conf.d/proxy.conf: | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
client_max_body_size 20M; | |
proxy_send_timeout 600; | |
proxy_read_timeout 1h; | |
send_timeout 600; | |
server_names_hash_bucket_size 128; | |
upstream backend { | |
server unix:///var/run/puma/my_app.sock; | |
} | |
map $uri $preferred_proto { | |
default "https"; | |
~^/(assets|public|packs)/ "none"; | |
~^/health_check "http"; | |
} | |
server { | |
listen 80; | |
if ($preferred_proto = "http") { | |
set $http_x_forwarded_proto $preferred_proto; | |
} | |
if ($preferred_proto = "none") { | |
set $preferred_proto $http_x_forwarded_proto; | |
} | |
if ($preferred_proto != $http_x_forwarded_proto) { | |
rewrite ^(.*) $preferred_proto://$host$request_uri redirect; | |
} | |
location / { | |
proxy_pass http://backend; | |
proxy_set_header Connection ""; | |
proxy_http_version 1.1; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header X-NginX-Proxy true; | |
location /packs { | |
root /var/app/current/public; | |
gzip_static on; | |
gzip on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
} | |
location /assets { | |
alias /var/app/current/public/assets; | |
gzip_static on; | |
gzip on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
location /public { | |
alias /var/app/current/public; | |
gzip_static on; | |
gzip on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment