Button to download file from another server to client

I have a website(server A) where files are saved at say, http://abcd.com/#filename. I want the website to have a button, where it downloads from another website(server E) where another file is located at say, http://efgh.com/filename.txt, i.e, the url suffix minus the hash tag, on the other website. I don’t want server A to download the file from server E and then serve it to the client. I want to be able to directly serve the file. Please help.

It looks to me like a CORS (Cross Origin Resource Sharing) problem. And the solution will come from the client and server E rather than from server A.

For this to work the client must make a special request to server E and server E must have CORS enable [1][2].
You should read this to know how to correctly form requests.

[1] you can test if a server has CORS enable here : http://www.test-cors.org/
[2] server E must have CORS enable for it to work. If it’s not, you’ll have to proxy the file to fake a same origin request, or enable it, if you own the server, or ask the server’s owner to enable it.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.