Behind reverse proxy, UIDL request URLs from browser incorrect

Our application is behind reverse proxy like this

https://external.address/my-external-context/my-app

proxy forwards to

http://internal.address:8080/my-app

The application (my-app) loads properly with all the resources. But then things go wrong. Browser starts to call server side with incorrect address, seems like this in chrome developer tools. Request URL seems to be without host name (external.address) and external context-path (/my-external-context/).

Any idea what might be wrong in the setup? Reverse proxy (F5) forwards x-forwarded-for, x-forwarded-proto, host headers properly to Tomcat where our application is running. I’ve added RemoteIpValve to tomcat context.xml, it has no effect.

  1. Request URL:
    https://my-app/vaadinServlet/UIDL/?v-uiId=0
  2. Referrer Policy:
    no-referrer-when-downgrade
  3. Request Headers
  4. Provisional headers are shown
  5. Access-Control-Request-Headers:
    content-type
  6. Access-Control-Request-Method:
    POST
  7. Origin:
    https://external.address/
  8. Referer:
    https://external.address/my-external-context/my-app
  9. Sec-Fetch-Mode:
    cors
  10. User-Agent:
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
  11. Query String Parametersview sourceview URL encoded
  12. v-uiId:
    0

Well, the only way to get this working, was to have exact same external context-path and internal-context path. In every other configuration we tested, UIDL requests failed with incorrect request URL (in some configurations we even got server name to request URL, but context-path was missing always)

I guess, Vaadin just can’t handle it?

This kind of configuration works:

https://external.address/my-external-context/my-app

http://internal.address:8080/my-external-context/my-app