mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2026-02-06 07:22:17 +00:00
Lack of compatibility with reverse proxy #274
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @theAkito on GitHub.
I set up an nginx vhost to proxy the requests to the local transfer.sh instance. Therefore, I have to designate localhost:port as the listener for requests to transfer.sh. (Btw. the documentation is horribly wrong, one aspect is that you actually have to provide the full address not only the port, when specifying port arguments.)
The problem now is that when I upload a file, it responds with a link containing the
localhost:port/wa3tr/test.txtURL instead of the one my reverse proxy listens to. I don't see a way to tell transfer.sh, that it should output a different URL, even if it listens on something entirely different.All I need is the possibility to override the default output after a file has been uploaded.
@paolafrancesca commented on GitHub:
—proxy-path should be a path, not a domain
so if you are proxing from http://yourdomin.com/apath to transfer.sh bound on localhost:8080 you should pass —proxy-path apath and set your proxy to erite as host header yourdomain.com
I may have misspelled the number of dashes required for the param to be accepted
@paolafrancesca commented on GitHub:
sorry @Akito13 , wrong issue
as for the proxy support, there are actually two problem: one is the path and one is the host
the path issue in solved in #206 (please, note that a new param --proxy-path is needed to instruct transfer.sh to build the proper redirect url), I ask you to test that branch
as for the host issue: you have to instruct your proxy to rewrite the host header with the original one, instead of overwriting with the one to the proxied service
on nginx you can achieve this with
proxy_set_header Host $host;@theAkito commented on GitHub:
@aspacca First of all, thank you for your quick response and action.
I checked out to ISSUE-203 but I get
when providing
It removes the first dash.
@paolafrancesca commented on GitHub:
then you don't need
--proxy-pathparam bust just to instruct your proxy to set the host header as the same as the domain of the proxyas I wrote before on nginx you can achieve this with
proxy_set_header Host $host;@theAkito commented on GitHub:
I don't use a path, I use the root directive. I just need my actual domain to be shown in the output after uploading a file and if possible change the UI as well, as this is also flooded with localhosts.
@theAkito commented on GitHub:
Even if this solves the problem partially, transfer.sh still thinks that it uses the localhost as a destination address, which also implies that when you visit mydomain.com where transfer.sh is hosted, then it shows all the links as localhost on the transfer.sh Web UI.
It'd be excellent, if there was a param like
--proxy-addresswhich replaces all visible output of transfer.sh links, while keeping the actual localhost in the background, but invisible to the outside.@paolafrancesca commented on GitHub:
transfer.sh supported proxy host rewriting since before I became maintainer of the project.
I use exactly in a proxy configuration with nginx and the url generated are correct.
All the links in UI are relative, so they doesn't contain the host part
As for the the urls generated by the backend, they come from the request done to the service: if the host header is set to the one of the front proxy than the url generated will have the host of the front proxy. There's no need for a
--proxy-addressflag.I think you have some misconfiguration in your proxy setup.
What software do you use? What's the configuration?
@theAkito commented on GitHub:
@aspacca Indeed, setting
proxy_set_header Host $host;within my vhost file helped. The only problems remaining arehttp://mydomain.com/qwert/filename.txtinstead ofhttps://mydomain.com/qwert/filename.txt.instead of
and finally, instead of
@paolafrancesca commented on GitHub:
@Akito13
pass this params to transfer.sh
As for the missing newline, it is intended behaviour wanted by @nl5887, you can use the following if you need the newline:
curl -s --upload-file filename.txt https://mydomain.com/filename.txt | xargs echo@theAkito commented on GitHub:
Well, so this part breaks it for me, anyway. I decided to create a modified version of the
transfer()function to fix thehttpsandechoissue. Now, if I remove only the thehttpsissue, there is still the unfixableechoissue, as the lack of new line is intentional. So, I have to rely ontransfer()anyway, which means I might as well solve thehttpsissue using the function, as well.Here is my function:
So far, I thank you for your help, I appreciate it. The original issue is now solved, so I will close this.
Just one last thing: is it easy to add the new line output to my fork of transfer.sh? I unfortunately don't know what I would need to edit to achieve that. If it is easy for you to tell me, it would be nice of you to do that.