Context Path with Webflux

后端 未结 9 1177
借酒劲吻你
借酒劲吻你 2021-02-07 18:52

I\'ve been trying to find a way to set the context path for a webflux application. I know I can configure it using

server.servlet.context-path

9条回答
  •  既然无缘
    2021-02-07 19:31

    For use cases where WebFlux application is behind load balancer/proxy you can use dedicated class - ForwardedHeaderTransformer that will extract path context from X-Forwarded-Prefix and will add it to ServerHttpRequest.

    Doing so you won't need to modify global context-path (which does not make sense in WebFlux)

    More about it here: https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html#webflux-web-handler-api

提交回复
热议问题