Answer the question
In order to leave comments, you need to log in
How to proxy requests for uploading images to VK servers?
In Vkontakte, files are uploaded in three stages. Getting the url on the client, sending the file and the url to the server, and then the server, having received the data from the VK, gives it to the client for saving. Sending files from the client makes browser cors impossible.
Accordingly, I would like to proxy requests to servers through nginx in order to load the server to a minimum.
However, when proxying, you need to make sure that the url really belongs to VK, for this you need to check the post variable with the url against the list of VK domains
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-http-request-headers-from domain="vk.com" headers="*"/>
<allow-http-request-headers-from domain="*.vk.com" headers="*"/>
<allow-http-request-headers-from domain="userapi.com" headers="*"/>
<allow-http-request-headers-from domain="*.userapi.com" headers="*"/>
<allow-http-request-headers-from domain="vk.me" headers="*"/>
<allow-http-request-headers-from domain="*.vk.me" headers="*"/>
<allow-http-request-headers-from domain="vkontakte.ru" headers="*"/>
<allow-http-request-headers-from domain="*.vkontakte.ru" headers="*"/>
<allow-http-request-headers-from domain="*.vk-cdn.net" headers="*"/>
<allow-access-from domain="vk.com" to-ports="80"/>
<allow-access-from domain="*.vk.com" to-ports="80"/>
<allow-access-from domain="vk.me" to-ports="80"/>
<allow-access-from domain="*.vk.me" to-ports="80"/>
<allow-access-from domain="userapi.com" to-ports="80"/>
<allow-access-from domain="*.userapi.com" to-ports="80"/>
<allow-access-from domain="vkontakte.ru" to-ports="80"/>
<allow-access-from domain="*.vkontakte.ru" to-ports="80"/>
<allow-access-from domain="*.vk-cdn.net" to-ports="80"/>
<allow-access-from domain="vk.me" to-ports="443"/>
<allow-access-from domain="*.vk.me" to-ports="443"/>
<allow-access-from domain="app.vk.com" to-ports="443"/>
<allow-access-from domain="*.vk-cdn.net" to-ports="443"/>
</cross-domain-policy>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question