Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

GWC local workspace URLs not working #380

Open
groldan opened this issue Nov 29, 2023 · 5 comments
Open

GWC local workspace URLs not working #380

groldan opened this issue Nov 29, 2023 · 5 comments
Assignees
Labels
bug Something isn't working Code Sprint good first issue Good for newcomers

Comments

@groldan
Copy link
Member

groldan commented Nov 29, 2023

Can't access local workspace urls for gwc (e.g. <context-path>/<workspace>/gwc/...)

@groldan groldan added the bug Something isn't working label Nov 29, 2023
@groldan groldan added the good first issue Good for newcomers label Jan 8, 2024
@pmauduit
Copy link
Collaborator

pmauduit commented Jan 9, 2024

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>

@pmauduit
Copy link
Collaborator

pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Jan 29, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Jan 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Jan 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Jul 3, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Aug 23, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Aug 23, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 26, 2024
@pmauduit
Copy link
Collaborator

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

@pmauduit
Copy link
Collaborator

turned out that using the geoserverDispatcher instead of the gwcDispatcher seems to make it.

pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 27, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 29, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Sep 30, 2024
pmauduit added a commit to pmauduit/geoserver-cloud that referenced this issue Oct 1, 2024
groldan added a commit that referenced this issue Oct 1, 2024
@groldan groldan closed this as completed Oct 1, 2024
groldan added a commit that referenced this issue Oct 8, 2024
@groldan groldan reopened this Oct 8, 2024
@pmauduit
Copy link
Collaborator

pmauduit commented Oct 9, 2024

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:

  • org.geoserver.security.AuthenticationKeyMangler
  • org.geoserver.ows.LocalWorkspaceURLMangler (ows = "ows")
  • org.geoserver.ows.LanguageURLMangler
  • org.geoserver.ows.LocalWorkspaceURLMangler (ows = "wms")
  • org.geoserver.ows.LocalWorkspaceURLMangler (ows = "gwc")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Code Sprint good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants