简体   繁体   中英

Jetty-Jersey how to handle requests behind reverse proxy?

I'm using:

  • Jetty 9.4.12.v20180830
  • Jersey 2.28

Is there a recommended way to decorate our web server to handle requests behind a reverse proxy?

Ie relative paths and Location headers do not come out correctly because the proxy has a different host and the routes are different.

I might expect to find filters to handle the (x-)forwarded* headers. For example, I found this one ( qaware/x-forwarded-filter ) but it is not a standard library...

Configure your reverse proxy to provide the Forwarded ( https://tools.ietf.org/html/rfc7239 ) request header to Jetty.

Then add the ForwardedRequestCustomizer to your HttpConfiguration within your ServerConnector .

That should be it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM