Answer the question
In order to leave comments, you need to log in
How to make a proxy in nginx for many images from an external site?
Hello!
I am optimizing the site according to the recommendations from pagespeed. There is a problem on "Use browser cache". I did it for local files, but I have external resources and I found an interesting topic with Yandex metrics.
location = /metrika.js {
expires 30d;
proxy_pass https://mc.yandex.ru/metrika/watch.js;
proxy_set_header Host mc.yandex.ru;
}
Answer the question
In order to leave comments, you need to log in
I tried options:
location ~* ^/catalog/(.*)$ {
proxy_pass $scheme://external.ru/catalog/$1;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* /catalog/(.*)$ {
proxy_pass $scheme://external.ru/catalog/$1;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
}
location /catalog {
proxy_pass $scheme://external.ru;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question