Questions tagged [nginx-cache]
23 questions
309
votes
25 answers
How to clear the cache of nginx?
I use nginx to as the front server, I have modified the CSS files, but nginx is still serving the old ones.
I have tried to restart nginx, to no success and I have Googled, but not found a valid way to clear it.
Some articles say we can just delete…

Freewind
- 193,756
- 157
- 432
- 708
5
votes
2 answers
POST response caching does not work in nginx
My task is to implement microcaching strategy using nginx, that is, cache responses of some POST endpoints for a few seconds.
In http section of the nginx.conf I have the following:
proxy_cache_path /tmp/cache keys_zone=cache:10m levels=1:2…

Roman Puchkovskiy
- 11,415
- 5
- 36
- 72
3
votes
0 answers
Kubernetes - Nginx cached content is getting deleted when stored in AWS EFS volume
I am using the official Nginx image with modified config to cache origin responses. The configuration below is includeed in the http block inside the /etc/nginx/nginx.conf (The main config file for Nginx)
proxy_cache_path /var/nginx-cache
…

Feras Maali
- 31
- 3
1
vote
0 answers
nginx cors error for prefligth request for chrome [backend tomcat server]
hello i am using ngnix as a static server
I am getting a error in chrome only [ Ensure preflight responses are valid ]
i tried
proxy_hide_header "Access-Control-Allow-Origin"
add_header 'Access-Control-Allow-Origin' $http_origin always
add_header…

SWAG TAMILAN
- 11
- 1
1
vote
0 answers
Purge and recreate cache of a specific URL in Nginx proxy cache
I have some websites using Nginx fcgi_cache to serve guests faster. but some day I update a menu in header or update a page.
Note: I have tried proxy_cache_purge directive and It's part of nginx commercial subscription.
Now I'm looking for a…

Alijvhr
- 1,695
- 1
- 3
- 22
1
vote
1 answer
What does Nginx take into account when caching a request?
What attributes(headers, cookies) besides url does Nginx take into account when caching a request?
I was trying to find out this information in nginx/log/access.log file. I have found only information about what type of request had been made(GET)…

Kenion
- 27
- 4
1
vote
0 answers
Nginx server cannot cache the contents of a webpage
I am new to nginx and I am trying to cache my website.
I have a website A that redirects the user to the website B if there is no cache stored.
Ideally, the website A should show the "old" version of the website B because website B gets updated…

John Doyle
- 57
- 3
1
vote
0 answers
NGINX - Setting a variable with regex replace
I'm looking to improve nginx caching by removing irrelevant query parameters (that could come from web crawlers or similar) from the request. I have come across an unwieldy solution on the internet:
set $c_uri $args; # e.g.…

Max Kless
- 36
- 4
1
vote
0 answers
Nginx proxy_cache_lock in multiple locations
http {
...
server {
...
location /good {
proxy_cache mycache;
proxy_cache_key $arg_cachekey;
proxy_cache_valid 200 1h;
proxy_cache_lock on;
…

Jonas
- 4,683
- 4
- 45
- 81
1
vote
1 answer
Nginx cache inactive parameter not working
I want to serve static files stored on a different server. For that I use Nginx cache with the following configuration.
Nginx cache conf:
proxy_cache_path /var/cache/cdn levels=1:2 keys_zone=cdn:64m max_size=20g inactive=10m…

AlberichVR
- 11
- 1
1
vote
1 answer
Prestashop Nginx FastCgi Caching
I'm trying to enable Nginx FastCgi cache in Prestashop 1.7 but i cannot find any way detecting logged in users or users with active carts in order to bypass cache.
Prestashop seems to not implement a correct cache control mechanism for hearers (…

sarakinos
- 666
- 11
- 28
0
votes
0 answers
How to manage browser cache only for index.html using nginx
I need some guidance with caching index.html. Right now I have the following directive in my nginx config:
location / {
root /usr/share/nginx/html;
include /etc/nginx/mime.types;
index index.html;
# Cache settings
proxy_cache…

Jeanluca Scaljeri
- 26,343
- 56
- 205
- 333
0
votes
0 answers
Nginx get file from cache instead of update it
There is no value for proxy_cache_valid in my nginx.conf file so as default it is equal to 1 hour. But I want for specific file set very small updating period, e.g. 10s, so I added to response a header "cache-control" that is equal to…

Uhno Semen
- 21
- 6
0
votes
1 answer
Nginx cache not working for certain URL's
I have some wordpress websites running. Nginx fcgi_cache is working for all of these websites but one!
This particular one is no different than others. But some of this site's URLs are not caching!
The cache status header always gives: MISS
This is…

Alijvhr
- 1,695
- 1
- 3
- 22
0
votes
0 answers
Cache control in Nginx+Django
I have a server on Nginx. It is written with Django and connected to Nginx through Waitress. I have set up a cache in Nginx. My server has both dynamic and static pages.
After starting a server, it caches only static pages(correct behaviour for me),…

Kenion
- 27
- 4