0

I have photoURL http://cs10821.vk.me/u712377/d_9da50e0f.jpg It is does not have header Access-Control-Allow-Origin *; I fix it with nginx. If I write

location /photo/cs10821.vk.me/u712377/d_9da50e0f.jpg {                  
    proxy_pass http://cs10821.vk.me/u712377/d_9da50e0f.jpg;             
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    add_header Access-Control-Allow-Origin *;
}

all work fine. I write http://servername.ru/photo/cs10821.vk.me/u712377/d_9da50e0f.jpg and I have my photo with header Access-Control-Allow-Origin *; But if I use regex

location ~ ^/photo/(.*)$ {      
    proxy_pass http://$1;               
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    add_header Access-Control-Allow-Origin *;
}

I have error 502. Help me please

1

Check the error log. You should have resolver defined.

Such as /etc/nginx/conf.d/resolver.conf:

resolver 8.8.8.8;
1
  • Excellent. Everything is working. Thank you very much – Nikolay Korotkov Nov 21 '16 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.