Sometimes my requests take up to an entire minute to respond

I set up my backend through cloudflare a few weeks ago. I was testing the endpoints and for some reason every 5-10 requests it can take up to an entire minute for it to respond to the request. The other times it seems fine. I have it just set up through nginx and lets encrypt with certbot. If I try make a request while it is loading it usually works fine for another 5-10 attempts. This happens for both people in different countries and even from the VPS locally if I make it make a request through the domain too I tried making requests directly to the IP/Port and it works fine, there are no random minute long delays to requests
server {
server_name api-minecrash.eimerarchive.org;

location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $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 $scheme;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/api-minecrash.eimerarchive.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api-minecrash.eimerarchive.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = api-minecrash.eimerarchive.org) {
return 301 https://$host$request_uri;
} # managed by Certbot

server_name api-minecrash.eimerarchive.org;
listen 80;
return 404; # managed by Certbot
}
server {
server_name api-minecrash.eimerarchive.org;

location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $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 $scheme;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/api-minecrash.eimerarchive.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api-minecrash.eimerarchive.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = api-minecrash.eimerarchive.org) {
return 301 https://$host$request_uri;
} # managed by Certbot

server_name api-minecrash.eimerarchive.org;
listen 80;
return 404; # managed by Certbot
}
No description
1 Reply
JustDoom
JustDoomOP•2w ago
I have a frontend hosted through cloudflare on the base domain too and it works fine, there are no slow responses. It is currently not on the same VPS I have not messed with any subdomain specific settings or anything the backend is using springboot and I have run them before without this issue Still happening with another site hosted on the VPS 😭 I FIGURED IT OUT FUIHAEFUIEA So I had disabled ipv6 when I set up the VPS. And in my nginx config I had proxy_pass http://localhost:4321;. Whenever a long request happened it would spit an error in the nginx error.log upstream: "http://[::1]:4321/". The issue was [::1]. It seems to sometimes have been making an ipv6 local request... I switched it to proxy_pass http://127.0.0.1:4321; and it seems to be working fine
Want results from more Discord servers?
Add your server