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

Host routing pattern not match when host contains port #3036 #3037

Closed
wants to merge 1 commit into from

Conversation

ashraf-revo
Copy link
Contributor

@ashraf-revo ashraf-revo commented Aug 23, 2023

fix #3036

@ashraf-revo ashraf-revo changed the title fix host predicate use host of InetSocketAddress insted of headers Host routing pattern not match when host contains port #3036 Aug 23, 2023
@spencergibb spencergibb added this to the 4.0.9 milestone Dec 6, 2023
@ashraf-revo ashraf-revo deleted the bug/3036 branch December 14, 2023 07:38
@aaHomeOfficeGit
Copy link

In our env we are running SCG on non standard ports like 9443 or 8089. When the client makes a call the HTTP header Host has the value which includes the non-standard port number like fqdn:9443

Until 4.1.0 scg version the host predicate definition had to include the comma separated list of fqdn1:9443,fqdn2:9443.

In a simple case the port number matching may make no sense, but there are cases when let say a https offloading rev proxy is shielding the scg, and the that rev proxy may even have listeners on multiple ports forwarding to the same scg. Let say the scg is listening on let say a 8090 port, but this port will never been seen by a client. In this case the scg may want to have a route which matches to a specific Host header's port. E.g fqdn:9443->service1.v1, fqdn:10443->service1.v2.
This port number based routing option is no longer possible with 4.1.0.

May be a new predicate would be better for Port on Host http header? ... except the Host header may not always have port number (I would need to check the specs)
Or may be the host predicate could check matching for: inetaddr.host and inetaddr.host+":"+inetaddr.port at the same time? ...

spencergibb added a commit that referenced this pull request Dec 21, 2023
This makes gh-3037 opt in by setting spring.cloud.gateway.predicate.host.include-port=false

Fixes gh-3190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

Host routing pattern not match when host contains port
4 participants