Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass alias as a header to service #248

Open
benperiton opened this issue Oct 10, 2022 · 3 comments
Open

Pass alias as a header to service #248

benperiton opened this issue Oct 10, 2022 · 3 comments
Labels
feature-request A request for a new feature good first issue Good for newcomers

Comments

@benperiton
Copy link

benperiton commented Oct 10, 2022

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?

@antoniomika antoniomika added good first issue Good for newcomers feature-request A request for a new feature labels Oct 10, 2022
@antoniomika
Copy link
Owner

antoniomika commented Oct 10, 2022

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?

@benperiton
Copy link
Author

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

@antoniomika
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A request for a new feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants