Describe the bug
When setting a spring.webflux.base-path property all routes using Path predicates return 404 results
Sample
application.name: demo
server.port: 8080
spring.webflux.base-path: /myapp
spring.cloud.gateway:
routes:
- id: google-route
uri: https://www.google.com/
predicates:
- Path=/api/**
filters:
- StripPrefix=1
Expected: Visit localhost:8080/myapp/api to see the google homepage (albeit stripped down).
Actual: 404
After digging a bit, I think this is because the PathRoutePredicateFactory uses the URI getRawPath.
Instead it could use a ServerHttpRequest's RequestPath then call pathWithinApplication, which is already set up correctly via the ContextPathCompositeHandler.
It is this ContextPathCompositeHandler which rejects the request earlier if you visit just localhost:8080/api, so the base-path property seems to be broken either way.
Is this change sensible? Or is there a separate feature which allows this functionality?
Thanks for your time.
Describe the bug
When setting a
spring.webflux.base-pathproperty all routes usingPathpredicates return 404 resultsSample
Expected: Visit
localhost:8080/myapp/apito see the google homepage (albeit stripped down).Actual: 404
After digging a bit, I think this is because the
PathRoutePredicateFactoryuses the URIgetRawPath.Instead it could use a
ServerHttpRequest'sRequestPaththen callpathWithinApplication, which is already set up correctly via theContextPathCompositeHandler.It is this
ContextPathCompositeHandlerwhich rejects the request earlier if you visit justlocalhost:8080/api, so thebase-pathproperty seems to be broken either way.Is this change sensible? Or is there a separate feature which allows this functionality?
Thanks for your time.