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

Change service URL based on request header "HOST" #19

Open
bio-boris opened this issue Feb 10, 2024 · 2 comments
Open

Change service URL based on request header "HOST" #19

bio-boris opened this issue Feb 10, 2024 · 2 comments

Comments

@bio-boris
Copy link
Contributor

bio-boris commented Feb 10, 2024

Request at staging.kbase.us

curl -s -d  '{"params":["JobBrowser"],"method":"ServiceWizard.list_service_status","version":"1.1","id":1}'  https://staging.kbase.us/services/service_wizard

Query: Headers {host = ''}
Response

{ url=staging.kbase.us/dynamic_services/JobBrowser }

Query: Headers {host = 'staging2.kbase.us'}
Response

{ url=staging2.kbase.us/dynamic_services/JobBrowser}

Request at staging2.kbase.us

curl -s -d  '{"params":["JobBrowser"],"method":"ServiceWizard.list_service_status","version":"1.1","id":1}'  https://staging2.kbase.us/services/service_wizard

Query: Headers {host = ''}
Response

{ url=staging2.kbase.us/dynamic_services/JobBrowser }

Query: Headers {host = 'staging3.kbase.us'}
Response

{ url=staging3.kbase.us/dynamic_services/JobBrowser}
@eapearson
Copy link

@bio-boris I think that is basically correct (although each url should include the protocol https://, but I'm sure you just begin brief, which I just spoiled.)

I'm not sure there is a valid case for the host being empty, though.

The host name for the initial request needs to be propagated by each proxy between the original client request and the upstream service.

The host should be available in the Host header, and available in nginx with the $http_host or $http nginx variables. They are similar but different.

@bio-boris
Copy link
Contributor Author

bio-boris commented Feb 13, 2024

Hmm, maybe I will add a README section about how SW2 needs to run behind a proxy and the headers

and this needs to match config values of allowed subdomains or else it will throw an error that that subdomain is not allowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants