Open groldan opened 1 year ago
reproduced / tested with the docker composition advised in the README (shared datadir), and a blank catalog. Creating a workspace / DS / layer works, I can access the following urls:
But indeed accessing http://localhost:9090/geoserver/cloud/<ns>/gwc/demo/<ns:layer>
or http://localhost:9090/geoserver/cloud/<ns>/gwc/demo/<layer>
does not.
It looks like the gateway configuration is already correct, and the issue is situated in the GWC microservice:
gwc_1 | 2024-01-09 15:57:44.375 WARN 1 --- [nio-8080-exec-7] o.s.web.servlet.PageNotFound : No mapping for GET /geoserver/cloud/<ns>/gwc/demo/<layer>
My guess was that the controller was lacking a request path here: https://github.com/geoserver/geoserver-cloud/blob/main/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java#L28
And the following beans were missing: https://github.com/geoserver/geoserver/blob/main/src/web/gwc/src/main/java/applicationContext.xml#L97-L111
but it is still not sufficient
Digging further and comparing with a regular geoserver, I wonder if we should use a gwcDispatcher
directly, or one class from the following package:
https://github.com/geoserver/geoserver/blob/main/src/gwc/src/main/java/org/geoserver/gwc/dispatch/package-info.java#L6-L37
turned out that using the geoserverDispatcher
instead of the gwcDispatcher
seems to make it.
We need to figure out why the gateway's base path sent as x-forwarded-path is duplicated in the getcaps responses.
Checking the WMTS GetCapabilities with my modifications, we indeed end up with duplicated path in the urls:
[...]
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://localhost:9090/geoserver/cloud/geoserver/cloud/gwc/service/wmts?">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>KVP</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
[...]
In the case of the GetCapabilities
, the responsible code is here:
https://github.com/GeoWebCache/geowebcache/blob/main/geowebcache/wmts/src/main/java/org/geowebcache/service/wmts/WMTSService.java#L585-L593
The urlMangler
being passed to the constructor is of type org.geoserver.gwc.ResponseUtilsURLMangler
, which transforms the baseUrl
(https://github.com/GeoWebCache/geowebcache/blob/main/geowebcache/wmts/src/main/java/org/geowebcache/service/wmts/WMTSGetCapabilities.java#L104) to http://localhost:9090/geoserver/cloud/geoserver/cloud/gwc/service/wmts
. This mangler also calls ResponseUtils.buildURL() which in turn iterates over all the URLMangler
objects (https://github.com/geoserver/geoserver/blob/main/src/ows/src/main/java/org/geoserver/ows/util/ResponseUtils.java#L390-L393). Considering the gwc service from the composition, I have the following ones instanciated:
Can't access local workspace urls for gwc (e.g.
<context-path>/<workspace>/gwc/...
)