antoniomika/sish

Pass alias as a header to service

benperiton opened this issue · 3 comments

I have a few sites that run locally for development, which I use the host-header=mysite.local.domain.com for, and that works just fine, the only issue is that all the links etc are set as mysite.local.domain.com rather than the alias used.

It would be handy if there was another header passed that said what the alias is.
For example:

ssh -R test:443:localhost:443 ssi.sh host-header=mysite.local.domain.com

would also pass through some headers like

X-Sish-Alias: test
X-Sish-Domain: test.ssi.sh

then I could check for the X-Sish-Domain header and adjust the links accordingly.

Is that possible now, or would it be something that maybe could be implemented?

This is not currently possible with sish, but shouldn't be very difficult to implement if someone is interested!

We'd need to change the forward proxy here:

fwd, err := forward.New(
to take a Rewriter from here: https://github.com/vulcand/oxy/blob/master/forward/fwd.go#L65 which modifies the request.

You can also use relative links to solve this issue?

Well, I gave it a go and submitted a PR.

Yea, I have a couple of ones that I can't change to be relative - they are generated automatically - but I think with the x-sish-host I can tweak it to work

Sounds good, I'll take a look in the coming few days! Thanks for the contribution :)