Answer the question
In order to leave comments, you need to log in
Which algorithm for uploading files to subdomains is more preferable?
Good evening!
Now I am writing a node.js microservice for uploading files to subdomains via API. Loading happens through normal http post request to which files are transferred.
Now the API accepts a token (which is naturally private) and an array of files, and at the output it gives JSON with the url of the file on the server, its stats (if thumbnails or compressions are given to it, then the urls and stats on them). In a nutshell, the user should not directly communicate with this service.
And the question arises: how to organize downloads to this subdomain on a real project.
1) proxy the user's post requests from the main site to the service.
2) first upload the user file to the main site, and then forward it to the service.
3) do the same as in paragraph 2, only for crown or celery. This should speed up the response from the server, which will allow you to redirect the user immediately to the page with the post, and only then transfer the files to the subdomain and change their URLs in the database.
What confuses:
1 option.
* if the user drops the connection, then the server should also stop proxying.
* double traffic consumption.
Option 2.
* long response from the server. In fact, this is double the loading time.
3 option.
* double cache in the user's browser. Since we are transferring the url.
* Perhaps this will not be appreciated by search engines. If they have time to index the picture, and it has already gone to the subdomain.
Which option is more preferable? Or maybe there's a silver bullet that I don't know about?
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