Created
March 9, 2022 08:05
-
-
Save eliyas5044/aacf8e7eb40df3c41ce25bb899977199 to your computer and use it in GitHub Desktop.
Prevent API cache in Nginx Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /api/ { | |
# Proxy | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_pass http://127.0.0.1:3000/api/; | |
proxy_redirect off; | |
proxy_buffers 32 16k; | |
proxy_busy_buffers_size 64k; | |
proxy_cache off; | |
# Headers for client browser NOCACHE + CORS origin filter | |
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; | |
expires off; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; | |
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept' always; | |
allow all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment