Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix URL creation when header X-Forwarded-Port and X-Forwarded-Host with port are used (3.5) #1756

Merged

Conversation

stephanr
Copy link
Member

@stephanr stephanr commented Nov 4, 2024

Backport of #1755
Description of #1755:

When deegree is used behind a proxy or load balancer, the initial Host header gets passed as X-Forwarded-Host.
Along the X-Forwarded-Host most proxies also pass the X-Forwarded-Port header.

As X-Forwarded-Host is not strictly defined by a standard (see [1]/[2] ) it is possible that the proxy also includes the port.
This results in an exception if the WFS capabilities are requested.

Example Request to trigger this:

curl --request GET \
  --url 'https://demo.deegree.org/inspire-workspace/services?SERVICE=WFS&REQUEST=GetCapabilities' \
  --header 'Host: demo.deegree.org:443'

Response (shortened):

<?xml version='1.0' encoding='UTF-8'?>
<WFS_Capabilities version="2.0.0" xmlns="http://www.opengis.net/wfs/2.0" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:ogc="http://www.opengis.net/ogc" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
  <ows:ServiceIdentification>
    <ows:Title>INSPIRE Addresses</ows:Title>
    <ows:Abstract>Direct Access Download Service for INSPIRE Addresses</ows:Abstract>
    <ows:ServiceType codeSpace="http://www.opengeospatial.org/">WFS</ows:ServiceType>
    <ows:ServiceTypeVersion>2.0.0</ows:ServiceTypeVersion>
    <ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion>
  </ows:ServiceIdentification>
  <ows:ServiceProvider>
    <!-- snip -->
  </ows:ServiceProvider>
  <ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd" version="2.0.0">
    <ows:Exception exceptionCode="NoApplicableCode"/>
  </ows:ExceptionReport>

References:

@stephanr stephanr added bug error issue and bug (fix) in progress core deegree core modules labels Nov 4, 2024
@stephanr stephanr added this to the 3.5.9 milestone Nov 4, 2024
@stephanr stephanr added ready and removed in progress labels Nov 5, 2024
@stephanr stephanr marked this pull request as ready for review November 5, 2024 10:07
@copierrj copierrj merged commit 377a434 into deegree:3.5-main Nov 6, 2024
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug error issue and bug (fix) core deegree core modules ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants