refactor(backend): better code quality, fix timeout issue, fix website eat port 3000, fix nginx wrong point, better docker compose file, moving some file and change some import, update package dependency etc.

This commit is contained in:
2026-07-06 21:44:30 +07:00 Unverified
parent 6a4f06f5aa
commit 05cf38d020
11 changed files with 238 additions and 198 deletions
+12 -4
View File
@@ -30,24 +30,32 @@ http {
limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=5r/s;
server {
listen 8606;
listen 80;
server_name localhost;
# Use Docker's internal DNS resolver with a short TTL
# This prevents caching stale IPs when containers are rebuilt
resolver 127.0.0.11 valid=10s;
set $upstream http://erika:3000;
# Bypass rate limit for static assets and Next.js internal files
location /_next/static/ {
proxy_pass http://127.0.0.1:3000;
proxy_pass $upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
# Cache static assets for 1 year (they have hashed filenames)
add_header Cache-Control "public, max-age=31536000, immutable";
allow all;
}
location /_next/ {
proxy_pass http://127.0.0.1:3000;
proxy_pass $upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
allow all;
}
# Apply rate limit to actual page loads and API requests
@@ -56,7 +64,7 @@ http {
limit_req zone=ratelimit burst=30 nodelay;
# Proxy to the Next.js app
proxy_pass http://127.0.0.1:3000;
proxy_pass $upstream;
# Next.js often requires HTTP/1.1
proxy_http_version 1.1;