Skip to content

Ability to map by host pattern instead of just path #121

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

Open
jwgmeligmeyling opened this issue May 28, 2021 · 6 comments · May be fixed by #123
Open

Ability to map by host pattern instead of just path #121

jwgmeligmeyling opened this issue May 28, 2021 · 6 comments · May be fixed by #123

Comments

@jwgmeligmeyling
Copy link

Use case: reverse proxy differently for various requested hosts.

Example syntax:

charonConfiguration()
   // ...
   .add(requestMapping().hostRegex("subdomain\..*").set(...))
   .add(requestMapping().hostRegex("subdomain2\..*").set(...))
jwgmeligmeyling added a commit to jwgmeligmeyling/charon-spring-boot-starter that referenced this issue May 28, 2021
@mkopylec
Copy link
Owner

Why do you need such feature?

@jwgmeligmeyling
Copy link
Author

jwgmeligmeyling commented May 31, 2021

I'm using Bloomreach CMS which uses 2 different applications that need to be deployed on an application server. These applications need to be deployed under specific context paths (/site and /cms respectively). Of course no one wants to deploy their site at /site, so you need to reverse proxy this. However, Bloomreach went all their way to make it impossible to efficiently host this stuff. So after you made the site available at contoso.com/ , contoso.com/cms still won't work fully. Instead, you need to bind it under cms.contoso.com and have a reverse proxy for that as well.

Because of all the reverse proxy hell required to get Bloomreach too work (goes much beyond the standard capabilities of a load balancer like AWS EC2's one), I've decided to just deploy one extra WAR into the container with the reverse proxies for both the site and CMS. For this I need to be able to use different proxy configurations for different requested hostnames.

@mkopylec
Copy link
Owner

mkopylec commented Jun 1, 2021

Ok. Will you manually set the Host HTTP header in HTTP client when sending request to server that uses Charon?
Is it even possible?

@mkopylec
Copy link
Owner

mkopylec commented Jun 1, 2021

To be more clear. What I see is:

Client -> Charon app (running behind some IP/domain) -> Outgoing servers (running behind some IP/domain)

Now, if you want the charon app to receive requests with Host header different than its IP/domain, you must set the header manually.

@jwgmeligmeyling
Copy link
Author

jwgmeligmeyling commented Jun 1, 2021

The client connects through a browser, which specifies the requested host as part of the Request URL.

So both cms.contoso.com and contoso.com resolve to the proxy IP running the Charon app. Based on the requested host (set by the browser in the request URL), the proxy forwards the request to the appropiate URL.

@mkopylec
Copy link
Owner

mkopylec commented Jun 1, 2021

Ok, I see the point now.

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

Successfully merging a pull request may close this issue.

2 participants