Jeffail/leaps

reverse proxy support

qknight opened this issue · 9 comments

reverse proxy setup

i tried to run leaps behind a reverse proxy, say:

https://example.com/leaps -> localhost:8080/leaps

or

https://example.com/leaps -> localhost:8080/
(this would require a different apache proxy configuration as shown below)

but i did not find a way to make leaps know it runs in a subdirectory. is there a configuration option?

apache config

# prevent a forward proxy! 
ProxyRequests off

# User-Agent / browser identification is used from the original client
ProxyVia Off
ProxyPreserveHost On

RewriteEngine On
RewriteRule ^/leaps$ /leaps/ [R]

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /leaps/ http://127.0.0.1:8080/leaps/ retry=0
ProxyPassReverse /leaps/ http://127.0.0.1:8080/leaps/

question

does anyone here have a working reverse proxy setup for apache or any other WS?

Hey @qknight, unfortunately the binary doesn't have that config option, but it would be trivial to add.

https://github.com/Jeffail/leaps/blob/master/cmd/leaps/leaps.go#L56 <- We add a flag there called -path which will be the root path (in this case we'd set it to /leaps.

https://github.com/Jeffail/leaps/blob/master/cmd/leaps/leaps.go#L67 <- We use the flag here, hPath = path.Join(*httpPath, hPath).

If I get time I can add it in pretty quickly.

nice. i will play with it and tell you if it works!

@Jeffail
here is the wanted help:
#32

@Jeffail
could you please provide the script you are using to build the asset go file? i would rather be able to do it myself and it should be part of the 'go build' so that ppl can change their own files.

Hey @qknight, it's these steps here: https://github.com/Jeffail/leaps/blob/master/cmd/leaps/package.go#L31
go get the packages and then run go generate within the ./cmd/leaps directory.

hey @Jeffail, we should focus on integrating these into the building process itself.

i've added a new issue: #33 for the bindata_assetfs.go problem

when #32 was merged, this issue can be closed!

Merged, had some fun diagnosing issues with strip prefix on empty paths and had to add some voodoo, might want to retest your use cases but you should be good to go.