XML response gets cut

1. Caddy version (caddy version):

v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=

2. How I run Caddy:

a. System environment:

Ubuntu 20.04, systemd

b. Command:

systemctl start caddy

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

gis.dvisca.de {
	file_server

	handle /qgisserver {
		reverse_proxy unix//var/run/fcgiwrap.socket {
			transport fastcgi {
				env SCRIPT_FILENAME /usr/lib/cgi-bin/qgis_mapserv.fcgi
				split ""
			}
		}
	}
}

3. The problem I’m having:

I’m trying to get QGIS server (a FCGI application) to work with Caddy. So far the basics are working but now my responses get cut. The connection gets terminated and I get an incomplete response.

4. Error messages and/or full log output:

curl -v "https://gis.dvisca.de/qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&map=/home/dominik/projects/world.qgs"
*   Trying 159.69.29.235:443...
* Connected to gis.dvisca.de (159.69.29.235) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=gis.dvisca.de
*  start date: Jun 20 12:08:59 2021 GMT
*  expire date: Sep 18 12:08:58 2021 GMT
*  subjectAltName: host "gis.dvisca.de" matched cert's "gis.dvisca.de"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x5625334af970)
> GET /qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&map=/home/dominik/projects/world.qgs HTTP/2
> Host: gis.dvisca.de
> user-agent: curl/7.77.0
> accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* Connection state changed (MAX_CONCURRENT_STREAMS == 250)!
< HTTP/2 200 
< content-type: text/xml; charset=utf-8
< error: Auth db directory path could not be created
< server: Caddy
< server: QGIS FCGI server - QGIS version 3.20.0-Odense
< content-length: 11412
< date: Sun, 20 Jun 2021 14:08:22 GMT
< 
<?xml version="1.0" encoding="utf-8"?>
<WMS_Capabilities xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd http://www.qgis.org/wms https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;SERVICE=WMS&amp;REQUEST=GetSchemaExtension" xmlns:sld="http://www.opengis.net/sld" xmlns="http://www.opengis.net/wms" xmlns:qgs="http://www.qgis.org/wms" version="1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <Service>
  <Name>WMS</Name>
  <Title>QGIS Server Demo</Title>
  <Abstract><![CDATA[This is a simple World map that showcases QGIS Server capabilities.]]></Abstract>
  <KeywordList>
   <Keyword vocabulary="ISO">infoMapAccessService</Keyword>
   <Keyword>QGIS Server World</Keyword>
  </KeywordList>
  <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs"/>
  <ContactInformation>
   <ContactPersonPrimary>
    <ContactPerson>Tudor Bărăscu</ContactPerson>
    <ContactOrganization>qgis.org</ContactOrganization>
   </ContactPersonPrimary>
   <ContactElectronicMailAddress>tudor.barascu@qtibia.ro</ContactElectronicMailAddress>
  </ContactInformation>
  <Fees>conditions unknown</Fees>
  <AccessConstraints>None</AccessConstraints>
 </Service>
 <Capability>
  <Request>
   <GetCapabilities>
    <Format>text/xml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;"/>
      </Get>
     </HTTP>
    </DCPType>
   </GetCapabilities>
   <GetMap>
    <Format>image/jpeg</Format>
    <Format>image/png</Format>
    <Format>image/png; mode=16bit</Format>
    <Format>image/png; mode=8bit</Format>
    <Format>image/png; mode=1bit</Format>
    <Format>application/dxf</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;"/>
      </Get>
     </HTTP>
    </DCPType>
   </GetMap>
   <GetFeatureInfo>
    <Format>text/plain</Format>
    <Format>text/html</Format>
    <Format>text/xml</Format>
    <Format>application/vnd.ogc.gml</Format>
    <Format>application/vnd.ogc.gml/3.1.1</Format>
    <Format>application/json</Format>
    <Format>application/geo+json</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;"/>
      </Get>
     </HTTP>
    </DCPType>
   </GetFeatureInfo>
   <sld:GetLegendGraphic>
    <Format>image/jpeg</Format>
    <Format>image/png</Format>
    <Format>application/json</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;"/>
      </Get>
     </HTTP>
    </DCPType>
   </sld:GetLegendGraphic>
   <sld:DescribeLayer>
    <Format>text/xml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;"/>
      </Get>
     </HTTP>
    </DCPType>
   </sld:DescribeLayer>
   <qgs:GetStyles>
    <Format>text/xml</Format>
    <DCPType>
     <HTTP>
      <Get>
       <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;"/>
      </Get>
     </HTTP>
    </DCPType>
   </qgs:GetStyles>
  </Request>
  <Exception>
   <Format>XML</Format>
  </Exception>
  <sld:UserDefinedSymbolization UserLayer="0" SupportSLD="1" InlineFeature="0" RemoteWCS="0" UserStyle="1" RemoteWFS="0"/>
  <Layer queryable="1">
   <Title>QGIS Server Demo</Title>
   <Abstract><![CDATA[This is a simple World map that showcases QGIS Server capabilities.]]></Abstract>
   <KeywordList>
    <Keyword vocabulary="ISO">infoMapAccessService</Keyword>
    <Keyword>QGIS Server World</Keyword>
   </KeywordList>
   <CRS>CRS:84</CRS>
   <CRS>EPSG:3857</CRS>
   <CRS>EPSG:900913</CRS>
   <CRS>EPSG:4326</CRS>
   <EX_GeographicBoundingBox>
    <westBoundLongitude>-189</westBoundLongitude>
    <eastBoundLongitude>189</eastBoundLongitude>
    <southBoundLatitude>-123</southBoundLatitude>
    <northBoundLatitude>118</northBoundLatitude>
   </EX_GeographicBoundingBox>
   <BoundingBox miny="-189" maxx="118" minx="-123" CRS="EPSG:4326" maxy="189"/>
   <BoundingBox miny="-19293806.199" maxx="19960441.004" minx="-19960441.004" CRS="EPSG:900913" maxy="30772816.154"/>
   <BoundingBox miny="-19293806.199" maxx="19960441.004" minx="-19960441.004" CRS="EPSG:3857" maxy="30772816.154"/>
   <Layer queryable="1">
    <Name>airports</Name>
    <Title>airports</Title>
    <CRS>CRS:84</CRS>
    <CRS>EPSG:3857</CRS>
    <CRS>EPSG:900913</CRS>
    <CRS>EPSG:4326</CRS>
    <EX_GeographicBoundingBox>
     <westBoundLongitude>-175.135635</westBoundLongitude>
     <eastBoundLongitude>179.195443</eastBoundLongitude>
     <southBoundLatitude>-53.781475</southBoundLatitude>
     <northBoundLatitude>78.246717</northBoundLatitude>
    </EX_GeographicBoundingBox>
    <BoundingBox miny="-175.135635" maxx="78.246717" minx="-53.781475" CRS="EPSG:4326" maxy="179.195443"/>
    <BoundingBox miny="-7128878.351" maxx="19947945.359" minx="-19496009.708" CRS="EPSG:900913" maxy="14502137.594"/>
    <BoundingBox miny="-7128878.351" maxx="19947945.359" minx="-19496009.708" CRS="EPSG:3857" maxy="14502137.594"/>
    <Style>
     <Name>default</Name>
     <Title>default</Title>
     <LegendURL>
      <Format>image/png</Format>
      <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetLegendGraphic&amp;LAYER=airports&amp;FORMAT=image/png&amp;STYLE=default&amp;SLD_VERSION=1.1.0"/>
     </LegendURL>
    </Style>
    <MinScaleDenominator>1</MinScaleDenominator>
    <MaxScaleDenominator>3.66192e+06</MaxScaleDenominator>
   </Layer>
   <Layer queryable="1">
    <Name>places</Name>
    <Title>places</Title>
    <CRS>CRS:84</CRS>
    <CRS>EPSG:3857</CRS>
    <CRS>EPSG:900913</CRS>
    <CRS>EPSG:4326</CRS>
    <EX_GeographicBoundingBox>
     <westBoundLongitude>-175.220565</westBoundLongitude>
     <eastBoundLongitude>179.216648</eastBoundLongitude>
     <southBoundLatitude>-41.299974</southBoundLatitude>
     <northBoundLatitude>64.150024</northBoundLatitude>
    </EX_GeographicBoundingBox>
    <BoundingBox miny="-175.220565" maxx="64.150024" minx="-41.299974" CRS="EPSG:4326" maxy="179.216648"/>
    <BoundingBox miny="-5056688.948" maxx="19950305.897" minx="-19505464.015" CRS="EPSG:900913" maxy="9387963.682"/>
    <BoundingBox miny="-5056688.948" maxx="19950305.897" minx="-19505464.015" CRS="EPSG:3857" maxy="9387963.682"/>
    <Style>
     <Name>default</Name>
     <Title>default</Title>
     <LegendURL>
      <Format>image/png</Format>
      <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://gis.dvisca.de/qgisserver?MAP=/home/dominik/projects/world.qgs&amp;SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetLegendGraphic&amp;LAYER=places&amp;FORMAT=image/png&amp;STYLE=default&amp;SLD_VERSION=1.1.0"/>
     </LegendURL>
    </Style>
   </Layer>
   <Layer queryable="1">
    <Name>countries</Name>
    <Title>countries</Title>
    <CRS>CRS:84</CRS>
    <CRS>EPSG:3857</CRS>
    <CRS>EPSG:900913</CRS>
    <CRS>EPSG:4326</CRS>
    <EX_GeographicBoundingBox>
     <westBoundLongitude>-180</westBoundLongitude>
* HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
* stopped the pause stream!
* Connection #0 to host gis.dvisca.de left intact
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
     <eastBou

5. What I already tried:

6. Links to relevant resources:

Looks like this error is being returned in the response headers. Seems like an issue in your QGIS app.

Yeah… very strange. It should absolutely not cause a problem like this, but fixing it actually helped. Thanks!

This topic was automatically closed after 30 days. New replies are no longer allowed.