support for subdirs
bioryb opened this issue · 8 comments
Hi!
To protect the goploader page via reverse proxy, I would like so work in a subfolder. This does not work, because goploader does not support relative links / subdirs. Is it possible to create a parameter to configure a "base url" ?
Same thing using https. The link presented by goploader is always http. If you want to use https, the link does not work. Would be great to have a parameter to support https, too.
Have a nice weekend!!!
In order to use goploader with a reverse proxy and for it to serve HTTPS links, you have to set the X-Forwarded-Proto
header in your proxy configuration. Otherwise goploader can't determine whether or not the request was HTTP or HTTPS (because it has no knowledge of your proxy and your proxy's configuration).
As for the subdirectory, I'm sorry but I don't get it. Could you give me an example of what you're trying to achieve ?
Hi,
I wanted to have a proxy using a subdir (virtual) like https://mydomain/goploader
and forward this to the goploader server via http. I think the issue concernig the subdir was a configureation fault on my site. But the link produced by goploader is http, because it is requested via http by the proxy. Can I change this without using https between the proxy and goploader?
Thanks in advance
Ronny
Hi,
I don't think this is related to goploader itself. It's more of a configuration problem on your proxy. It is not related on how your proxy talks to goploader, it's about the information sent by your proxy.
For example, here is my Caddy configuration :
gpldr.in up.depado.eu {
proxy / 127.0.0.1:8002 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
gzip
}
This is actually quite simple : Simply forward the protocol your proxy receives to the goploader server, and it will send back a link with the appropriate protocol. (Meaning, if someone sends an http request, goploader will send back an http link, same applies if someone sends an https request)
nginx
proxy_set_header X-Forwarded-Proto $scheme;
(both http and https)
or
proxy_set_header X-Forwarded-Proto "https;
(only https)
Apache
RequestHeader set X-Forwarded-Proto 'https' env=HTTPS
(both http and https)
or
RequestHeader set X-Forwarded-Proto "https"
(only https)
Caddy
proxy_header X-Forwarded-Proto {scheme}
Hope this helps
EDIT: About the subdirectory stuff, you should customize your name_server
to mydomain.com/goploader
I think. Although I did not test that.
Hi,
the parameter RequestHeader
for apache works. THX!
The other issue with subdirs did not work. Because I will protect this site using username and password, this is no showstopper ;-)
If you are interested in: the index.html has to be changed to link the .js files to the subfolder. But if you want to upload a file, jquery uses the absolute path ( / ) and so it does not work. I did not find where to configure that ...
So the second issue is about the way static files are handled. I'll have a look later. Thanks for the feedback :)
I got it to work with a subdir, e.g. http://my.server.com/gop/
First of all I had to replace all \static\
href and script src in index.html
with /gop/static/
.
Then to make the upload script work in custom.js
change url (line 106) to '/gop/'.
And then to have the download links displayed correct, append /gop
to my name_server
variable in the config file.
So based on that it shouldn't be too difficult to make it work with a base_dir
variable in the config file. I haven't looked at the code at all, though.