M
M
Melodic2017-03-02 13:31:01
Nginx
Melodic, 2017-03-02 13:31:01

How to disable caching by nginx of files that are returned using a php script?

There is a URL like /avatar/id3/ , which returns an image, depending on the result of a certain condition, which is calculated inside the script. So, the problem is that nginx caches the first result and then constantly returns this image ( 304 Not modified ). How to solve this problem?
Nginx works as a proxy for Apache. Those. such config
location / {
proxy_pass http://*:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_logoff;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Serenko, 2017-03-02
@p1r4te

location / {
proxy_pass http://*:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_logoff;
expires off;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question