This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-c2e031c7-e08c-4adb-80b0-aae9cdf4462d XWIKI-25427 Open

Adding RFC 7239 Forwarded header causes redirect to internal HTTP address despite correct host/proto

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-7c5902d5-67b5-4ba8-927d-a22309da6aaf XenGi created this issue on 20/Oct/26 17:01
 
Summary: Adding RFC 7239 Forwarded header causes redirect to internal HTTP address despite correct host/proto
Issue Type: cid:jira-generated-image-avatar-c2e031c7-e08c-4adb-80b0-aae9cdf4462d Bug
Affects Versions: 18.3.0
Assignee: Unassigned
Created: 20/Oct/26 17:01
Environment: - Container image and tag: xwiki:18.3-postgres-tomcat
- Kubernetes, behind NGINX Gateway Fabric 2.7.2
- TLS terminates at the gateway; backend traffic uses HTTP
Priority: cid:jira-generated-image-static-major-347a3862-d2f8-464a-923f-6d1e9a2ee25a Major
Reporter: XenGi
Description:

Summary:

When a Forwarded header is present alongside correct Host and
X-Forwarded-* headers, the root-page redirect uses an internal IP,
an unexpected port, and HTTP instead of the public HTTPS URL.

The problem can be reproduced by calling the Kubernetes Service
directly, bypassing the gateway.

Working request:

curl -sS -D - -o /dev/null \
  http://xwiki.ns.svc.cluster.local/ \
  -H 'Host: wiki.example.com' \
  -H 'X-Forwarded-Host: wiki.example.com' \
  -H 'X-Forwarded-Proto: https' \
  -H 'X-Forwarded-Port: 443'

Result:
HTTP/1.1 302
Location: https://wiki.example.com/bin/view/Main/

Failing request (only change: add Forwarded):

curl -sS -D - -o /dev/null \
  http://xwiki.ns.svc.cluster.local/ \
  -H 'Host: wiki.example.com' \
  -H 'X-Forwarded-Host: wiki.example.com' \
  -H 'X-Forwarded-Proto: https' \
  -H 'X-Forwarded-Port: 443' \
  -H 'Forwarded: by="10.0.0.1:443";for="192.0.2.1:12345";host="wiki.example.com";proto=https'

Actual result:
HTTP/1.1 302
Location: http://172.16.0.11:63190/bin/view/Main/

Expected result:
Location: https://wiki.example.com/bin/view/Main/

Workaround:
Suppress Forwarded for XWiki and retain Host and X-Forwarded-*.

Please investigate how the presence of Forwarded affects redirect
URL construction and interaction with X-Forwarded-* headers.

According to XWIKI-15505 and XWIKI-21710 handling of the Forwarded header should work.

 
 

1 update

 
cid:jira-generated-image-avatar-7c5902d5-67b5-4ba8-927d-a22309da6aaf Changes by XenGi on 20/Oct/26 17:02
 
Description: Summary:

When a Forwarded header is present alongside correct Host and
X-Forwarded-* headers, the root-page redirect uses an internal IP,
an unexpected port, and HTTP instead of the public HTTPS URL.

The problem can be reproduced by calling the Kubernetes Service
directly, bypassing the gateway.

Working request:
{code}
curl -sS -D - -o /dev/null \
  http://xwiki.ns.svc.cluster.local/
  \
  -H 'Host: wiki.example.com'
  \
  -H 'X-Forwarded-Host: wiki.example.com'
  \
  -H 'X-Forwarded-Proto: https'
  \
  -H 'X-Forwarded-Port: 443'
{code}

Result:
{code}
HTTP/1.1 302
Location: https://wiki.example.com/bin/view/Main/
{code}

Failing request (only change: add Forwarded):
{code}
curl -sS -D - -o /dev/null \
  http://xwiki.ns.svc.cluster.local
/ \
  -H 'Host: wiki.example.com' \
  -H 'X-Forwarded-Host: wiki.example.com' \
  -H 'X-Forwarded-Proto: https' \
  -H 'X-Forwarded-Port: 443' \
  -H 'Forwarded: by="10.0.0.1:443";for="192.0.2.1:12345";host="wiki.example.com";proto=https'
{code}

Actual result:
{code}
HTTP/1.1 302
Location: http://172.16.0.11:63190/bin/view/Main/
{code}

Expected result:
{code}
Location: https://wiki.example.com/bin/view/Main/
{code}

Workaround:
Suppress Forwarded for XWiki and retain Host and X-Forwarded-*.

Please investigate how the presence of Forwarded affects redirect
URL construction and interaction with X-Forwarded-* headers.

According to XWIKI-15505 and XWIKI-21710 handling of the Forwarded header should work.