A
A
Alex2019-10-29 17:37:44
PHP
Alex, 2019-10-29 17:37:44

How to pass a file through the server without uploading to the server?

There is a PHP7 + Nginx server. You need to send the file to another domain, for this now the JS file is sent to the server on a POST request, and then sent to another domain.
Is it possible to redirect the request to another domain without uploading a file to the server, reducing the load on the server?
p/s Perhaps there are other solutions, I will be glad for a hint :)
UPDATE: the server is not under control and the solution is essentially bypassing Access-Control-Allow-Origin. I also came across this "proxy" method https://github.com/Rob--W/cors-anywhere/#documentation
Is it possible to implement this on Nginx and send POST requests with a file (multipart/form-data) in this way? ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NiceDay, 2019-11-20
@alexjet73

Without saving the file, you can send it to another server by proxying the request through nginx.
In theory, it will be enough to add a location block with proxy_pass to the desired address.
If you are accessing the second server by hostname, then you should also add resolver , I usually put Google's 8.8.8.8

A
Anton Neverov, 2019-10-29
@TTATPuOT

You can, just like you are uploading to your server now, directly upload to the destination server via ajax.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question