There are 3 updates, 2 comments.
 
 
XWiki Docker images / cid:jira-generated-image-avatar-e7b13a70-9e34-42bb-821c-3945600e8d9b XDOCKER-191 Closed

XWiki Public Address not resolving properly

 
View issue   ·   Add comment
 

3 updates

 
cid:jira-generated-image-avatar-8facf763-57c8-4317-a725-4eaa8421f68c Changes by Vincent Massol on 19/Jul/26 10:33
 
Assignee: Vincent Massol
Resolution: Fixed
Status: Open Closed
 
 

2 comments

 
cid:jira-generated-image-avatar-8facf763-57c8-4317-a725-4eaa8421f68c Vincent Massol on 19/Jul/26 10:33
 

This is a Tomcat configuration matter rather than an image bug. By default Tomcat does not honor the X-Forwarded-* headers, so when a reverse proxy terminates TLS and forwards to XWiki over plain HTTP, the Servlet API (request.getScheme(), isSecure(), getRequestURL(), getServerPort()) reports the internal http scheme/port — hence the wrong URLs (e.g. redirects dropping to http://, or {{https://host:80/}}).

Note that the linked XWIKI-18714 (fixed in 12.10.8 / 13.5) already made XWiki's own XWiki#getRequestURL independent of the application server by reading the forwarded headers itself (HttpServletUtils#getSourceURL). What remained affected is any code path still going through the raw Servlet API (third-party extensions, some auth/redirect flows such as OIDC), which explains the later reports here.

The proper fix on the container side is to make Tomcat trust the proxy headers via a RemoteIpValve. Rather than shipping/toggling this in the image (reverse-proxy setups are too heterogeneous, and the proxy-side header configuration must be done by the user anyway), we've documented it in the README, with a ready-to-use context.xml snippet and the compose/run mount, plus the required nginx headers:
https://github.com/xwiki/xwiki-docker/blob/master/README.md#running-behind-a-reverse-proxy

This complements the general [HTTP Reverse Proxy|https://www.xwiki.org/xwiki/bin/view/documentation/xs/admin/installation/http-reverse-proxy/] documentation. With the RemoteIpValve in place the forwarded scheme/port are applied to all requests, resolving the public-address problem. I'm therefore closing this as documented — please reopen if a case remains unaddressed.

 
cid:jira-generated-image-avatar-8facf763-57c8-4317-a725-4eaa8421f68c Vincent Massol on 19/Jul/26 10:34
 
This is a Tomcat configuration matter rather than an image bug. By default Tomcat does not honor the {{X \ -Forwarded \ - \ *}} headers, so when a reverse proxy terminates TLS and forwards to XWiki over plain HTTP, the Servlet API \ ({{request.getScheme \ ( \ )}}, {{isSecure \ ( \ )}}, {{getRequestURL \ ( \ )}}, {{getServerPort \ ( \ )}} \ ) reports the internal {{http}} scheme/port — hence the wrong URLs \ (e.g. redirects dropping back to {{http://}} plain HTTP , or {{[https:// the public host : being generated with the internal port such as port 80 /}}|https://host:80/}}]\ ).

Note that the linked XWIKI
\ -18714 \ (fixed in 12.10.8 / 13.5 \ ) already made XWiki's _own_ *own* {{XWiki#getRequestURL}} independent of the application server by reading the forwarded headers itself \ ({{HttpServletUtils#getSourceURL}} \ ). What remained affected is any code path still going through the raw Servlet API \ (third \ -party extensions, some auth/redirect flows such as OIDC \ ), which explains the later reports here.

The proper fix on the container side is to make Tomcat trust the proxy headers via a {{RemoteIpValve}}. Rather than shipping/toggling this in the image
\ (reverse \ -proxy setups are too heterogeneous, and the proxy \ -side header configuration must be done by the user anyway \ ), we've documented it in the README, with a ready \ -to \ -use {{context.xml}} snippet and the compose/run mount, plus the required nginx headers:
[ https://github.com/xwiki/xwiki \ -docker/blob/master/README.md#running \ -behind \ -a \ -reverse \ -proxy |https://github.com/xwiki/xwiki-docker/blob/master/README.md#running-behind-a-reverse-proxy]

This complements the general
\ [HTTP Reverse Proxy| [ https://www.xwiki.org/xwiki/bin/view/documentation/xs/admin/installation/http \ -reverse \ -proxy/ |https://www.xwiki.org/xwiki/bin/view/documentation/xs/admin/installation/http-reverse-proxy/ ] \] documentation. With the {{RemoteIpValve}} in place the forwarded scheme/port are applied to all requests, resolving the public \ -address problem. I'm therefore closing this as documented — please reopen if a case remains unaddressed.