Skip to content

Fix GWC virtual service URLs and clean up handler mapping migration - #767

Merged
groldan merged 1 commit into
geoserver:mainfrom
groldan:fix/gwc_url_handling
Mar 3, 2026
Merged

groldan merged 1 commit into
geoserver:mainfrom
groldan:fix/gwc_url_handling

Conversation

@groldan

@groldan groldan commented Mar 3, 2026

Copy link
Copy Markdown
Member
  • Fix virtual service GWC demo/REST URLs returning 404
    • Add CloudGwcUrlHandlerMapping to update Spring 6's cached
      PathPattern request path for virtual service handler matching
    • Fix SetRequestPathInfoFilter to strip workspace prefix from
      requestURI so GeoWebCacheDispatcher.normalizeURL() works
  • Add missing gs-wms1_1 dependency to the gwc service after the WMS split
  • Remove SeedControllerOverride, unnecessary after gwc migration to Spring 7 (ref: Spring 7 and Jackson 3 update GeoWebCache/geowebcache#1467)
  • Remove unnecessary requestMappingHandlerMapping bean

@groldan
groldan force-pushed the fix/gwc_url_handling branch from 553e3ae to 3d446a0 Compare March 3, 2026 02:30
* Fix virtual service GWC demo/REST URLs returning 404
  - Add CloudGwcUrlHandlerMapping to update Spring 6's cached
    PathPattern request path for virtual service handler matching
  - Fix SetRequestPathInfoFilter to strip workspace prefix from
    requestURI so GeoWebCacheDispatcher.normalizeURL() works
* Add missing gs-wms1_1 dependency to the gwc service after the WMS split
* Remove SeedControllerOverride, unnecessary after gwc migration to Spring 7 (ref: GeoWebCache/geowebcache#1467)
* Remove unnecessary requestMappingHandlerMapping bean
@groldan
groldan force-pushed the fix/gwc_url_handling branch from 3d446a0 to 79d4252 Compare March 3, 2026 02:37
@groldan
groldan merged commit 8d79b85 into geoserver:main Mar 3, 2026
6 of 8 checks passed
@groldan
groldan deleted the fix/gwc_url_handling branch March 3, 2026 13:41
mohamed-aboshosha-up42 added a commit to mohamed-aboshosha-up42/geoserver-cloud that referenced this pull request Mar 9, 2026
Add GwcRequestPathInfoFilter and CloudGwcUrlHandlerMapping for improved URL handling

- Introduced GwcRequestPathInfoFilter to adapt HttpServletRequest for proper path info handling in GWC.
- Created CloudGwcUrlHandlerMapping to extend GwcUrlHandlerMapping, addressing issues with virtual service URL handling in Spring 6.
- Updated GeoWebCacheApplicationConfiguration and RESTConfigConfiguration to utilize the new classes.
- Added unit tests for both GwcRequestPathInfoFilter and CloudGwcUrlHandlerMapping to ensure correct functionality.
mohamed-aboshosha-up42 added a commit to mohamed-aboshosha-up42/geoserver-cloud that referenced this pull request Mar 9, 2026
Backport the GWC virtual service URL fix from geoserver#767
(main branch) to release/2.28.x, adapted for Spring 5 / javax.servlet.

GWC virtual service URLs (e.g. /{workspace}/gwc/service/wmts,
/{workspace}/gwc/demo/...) were not properly handled in GeoServer Cloud.
The URL handler mapping and request path adaptation did not account for the
workspace prefix at the HTTP dispatch level.

New classes:

- GwcRequestPathInfoFilter: servlet filter that adapts HttpServletRequest
  for GWC path info handling. For /gwc/service/** paths, the workspace
  prefix is preserved in the request URI so LocalWorkspaceCallback can
  detect the workspace. For non-service paths (/gwc/demo, /gwc/rest), the
  workspace prefix is stripped so GeoWebCacheDispatcher.normalizeURL()
  works correctly.

- CloudGwcUrlHandlerMapping: extends GwcUrlHandlerMapping to fix virtual
  service URL matching with Spring's PathPattern-based request matching.
  Updates the cached parsed request path before delegation so
  workspace-prefixed URLs resolve to the correct controller.

Changes to existing classes:

- GeoServerTileLayerConfiguration: override getLayers() and getLayer() to
  filter by LocalWorkspace/LocalPublished thread-local context. This is the
  common TileLayerConfiguration decorator that wraps all backends, making it
  the correct abstraction level for virtual service filtering (analogous to
  upstream CatalogConfiguration.getTileLayerById()).

- PgconfigTileLayerCatalog: pass catalog to GeoServerTileLayer constructor
  so getContextualName() can resolve workspace prefixes without NPE. The
  backend itself returns all layers unfiltered.

- GeoWebCacheCoreConfiguration: replaced inline SetRequestPathInfoFilter
  with the new GwcRequestPathInfoFilter bean.

- GeoWebCacheApplicationConfiguration: calls
  GwcRequestPathInfoFilter.adaptRequest() before the existing filter.

- GeoWebCacheUIAutoConfiguration: added gwcDemoUrlHandlerMapping and
  gwcRestWebUrlHandlerMapping beans using CloudGwcUrlHandlerMapping.

- RESTConfigConfiguration: use CloudGwcUrlHandlerMapping for the WMTS REST
  URL handler mapping.

Includes unit tests for GwcRequestPathInfoFilter and
CloudGwcUrlHandlerMapping.

Refs: geoserver#767, geoserver#766
groldan pushed a commit to mohamed-aboshosha-up42/geoserver-cloud that referenced this pull request Mar 17, 2026
Backport the GWC virtual service URL fix from geoserver#767
(main branch) to release/2.28.x, adapted for Spring 5 / javax.servlet.

GWC virtual service URLs (e.g. /{workspace}/gwc/service/wmts,
/{workspace}/gwc/demo/...) were not properly handled in GeoServer Cloud.
The URL handler mapping and request path adaptation did not account for the
workspace prefix at the HTTP dispatch level.

New classes:

- GwcRequestPathInfoFilter: servlet filter that adapts HttpServletRequest
  for GWC path info handling. For /gwc/service/** paths, the workspace
  prefix is preserved in the request URI so LocalWorkspaceCallback can
  detect the workspace. For non-service paths (/gwc/demo, /gwc/rest), the
  workspace prefix is stripped so GeoWebCacheDispatcher.normalizeURL()
  works correctly.

- CloudGwcUrlHandlerMapping: extends GwcUrlHandlerMapping to fix virtual
  service URL matching with Spring's PathPattern-based request matching.
  Updates the cached parsed request path before delegation so
  workspace-prefixed URLs resolve to the correct controller.

Changes to existing classes:

- GeoServerTileLayerConfiguration: override getLayers() and getLayer() to
  filter by LocalWorkspace/LocalPublished thread-local context. This is the
  common TileLayerConfiguration decorator that wraps all backends, making it
  the correct abstraction level for virtual service filtering (analogous to
  upstream CatalogConfiguration.getTileLayerById()).

- PgconfigTileLayerCatalog: pass catalog to GeoServerTileLayer constructor
  so getContextualName() can resolve workspace prefixes without NPE. The
  backend itself returns all layers unfiltered.

- GeoWebCacheCoreConfiguration: replaced inline SetRequestPathInfoFilter
  with the new GwcRequestPathInfoFilter bean.

- GeoWebCacheApplicationConfiguration: calls
  GwcRequestPathInfoFilter.adaptRequest() before the existing filter.

- GeoWebCacheUIAutoConfiguration: added gwcDemoUrlHandlerMapping and
  gwcRestWebUrlHandlerMapping beans using CloudGwcUrlHandlerMapping.

- RESTConfigConfiguration: use CloudGwcUrlHandlerMapping for the WMTS REST
  URL handler mapping.

Includes unit tests for GwcRequestPathInfoFilter and
CloudGwcUrlHandlerMapping.

Refs: geoserver#767, geoserver#766
groldan pushed a commit to mohamed-aboshosha-up42/geoserver-cloud that referenced this pull request Mar 17, 2026
Backport the GWC virtual service URL fix from geoserver#767
(main branch) to release/2.28.x, adapted for Spring 5 / javax.servlet.

GWC virtual service URLs (e.g. /{workspace}/gwc/service/wmts,
/{workspace}/gwc/demo/...) were not properly handled in GeoServer Cloud.
The URL handler mapping and request path adaptation did not account for the
workspace prefix at the HTTP dispatch level.

New classes:

- GwcRequestPathInfoFilter: servlet filter that adapts HttpServletRequest
  for GWC path info handling. For /gwc/service/** paths, the workspace
  prefix is preserved in the request URI so LocalWorkspaceCallback can
  detect the workspace. For non-service paths (/gwc/demo, /gwc/rest), the
  workspace prefix is stripped so GeoWebCacheDispatcher.normalizeURL()
  works correctly.

- CloudGwcUrlHandlerMapping: extends GwcUrlHandlerMapping to fix virtual
  service URL matching with Spring's PathPattern-based request matching.
  Updates the cached parsed request path before delegation so
  workspace-prefixed URLs resolve to the correct controller.

Changes to existing classes:

- GeoServerTileLayerConfiguration: override getLayers() and getLayer() to
  filter by LocalWorkspace/LocalPublished thread-local context. This is the
  common TileLayerConfiguration decorator that wraps all backends, making it
  the correct abstraction level for virtual service filtering (analogous to
  upstream CatalogConfiguration.getTileLayerById()).

- PgconfigTileLayerCatalog: pass catalog to GeoServerTileLayer constructor
  so getContextualName() can resolve workspace prefixes without NPE. The
  backend itself returns all layers unfiltered.

- GeoWebCacheCoreConfiguration: replaced inline SetRequestPathInfoFilter
  with the new GwcRequestPathInfoFilter bean.

- GeoWebCacheApplicationConfiguration: calls
  GwcRequestPathInfoFilter.adaptRequest() before the existing filter.

- GeoWebCacheUIAutoConfiguration: added gwcDemoUrlHandlerMapping and
  gwcRestWebUrlHandlerMapping beans using CloudGwcUrlHandlerMapping.

- RESTConfigConfiguration: use CloudGwcUrlHandlerMapping for the WMTS REST
  URL handler mapping.

Includes unit tests for GwcRequestPathInfoFilter and
CloudGwcUrlHandlerMapping.

Refs: geoserver#767, geoserver#766
groldan pushed a commit to mohamed-aboshosha-up42/geoserver-cloud that referenced this pull request Mar 17, 2026
Backport the GWC virtual service URL fix from geoserver#767
(main branch) to release/2.28.x, adapted for Spring 5 / javax.servlet.

GWC virtual service URLs (e.g. /{workspace}/gwc/service/wmts,
/{workspace}/gwc/demo/...) were not properly handled in GeoServer Cloud.
The URL handler mapping and request path adaptation did not account for the
workspace prefix at the HTTP dispatch level.

New classes:

- GwcRequestPathInfoFilter: servlet filter that adapts HttpServletRequest
  for GWC path info handling. For /gwc/service/** paths, the workspace
  prefix is preserved in the request URI so LocalWorkspaceCallback can
  detect the workspace. For non-service paths (/gwc/demo, /gwc/rest), the
  workspace prefix is stripped so GeoWebCacheDispatcher.normalizeURL()
  works correctly.

- CloudGwcUrlHandlerMapping: extends GwcUrlHandlerMapping to fix virtual
  service URL matching with Spring's PathPattern-based request matching.
  Updates the cached parsed request path before delegation so
  workspace-prefixed URLs resolve to the correct controller.

Changes to existing classes:

- GeoServerTileLayerConfiguration: override getLayers() and getLayer() to
  filter by LocalWorkspace/LocalPublished thread-local context. This is the
  common TileLayerConfiguration decorator that wraps all backends, making it
  the correct abstraction level for virtual service filtering (analogous to
  upstream CatalogConfiguration.getTileLayerById()).

- PgconfigTileLayerCatalog: pass catalog to GeoServerTileLayer constructor
  so getContextualName() can resolve workspace prefixes without NPE. The
  backend itself returns all layers unfiltered.

- GeoWebCacheCoreConfiguration: replaced inline SetRequestPathInfoFilter
  with the new GwcRequestPathInfoFilter bean.

- GeoWebCacheApplicationConfiguration: calls
  GwcRequestPathInfoFilter.adaptRequest() before the existing filter.

- GeoWebCacheUIAutoConfiguration: added gwcDemoUrlHandlerMapping and
  gwcRestWebUrlHandlerMapping beans using CloudGwcUrlHandlerMapping.

- RESTConfigConfiguration: use CloudGwcUrlHandlerMapping for the WMTS REST
  URL handler mapping.

Includes unit tests for GwcRequestPathInfoFilter and
CloudGwcUrlHandlerMapping.

Refs: geoserver#767, geoserver#766
mohamed-aboshosha-up42 added a commit to mohamed-aboshosha-up42/geoserver-cloud that referenced this pull request Mar 19, 2026
Backport the GWC virtual service URL fix from geoserver#767
(main branch) to release/2.28.x, adapted for Spring 5 / javax.servlet.

GWC virtual service URLs (e.g. /{workspace}/gwc/service/wmts,
/{workspace}/gwc/demo/...) were not properly handled in GeoServer Cloud.
The URL handler mapping and request path adaptation did not account for the
workspace prefix at the HTTP dispatch level.

New classes:

- GwcRequestPathInfoFilter: servlet filter that adapts HttpServletRequest
  for GWC path info handling. For /gwc/service/** paths, the workspace
  prefix is preserved in the request URI so LocalWorkspaceCallback can
  detect the workspace. For non-service paths (/gwc/demo, /gwc/rest), the
  workspace prefix is stripped so GeoWebCacheDispatcher.normalizeURL()
  works correctly.

- CloudGwcUrlHandlerMapping: extends GwcUrlHandlerMapping to fix virtual
  service URL matching with Spring's PathPattern-based request matching.
  Updates the cached parsed request path before delegation so
  workspace-prefixed URLs resolve to the correct controller.

Changes to existing classes:

- GeoServerTileLayerConfiguration: override getLayers() and getLayer() to
  filter by LocalWorkspace/LocalPublished thread-local context. This is the
  common TileLayerConfiguration decorator that wraps all backends, making it
  the correct abstraction level for virtual service filtering (analogous to
  upstream CatalogConfiguration.getTileLayerById()).

- PgconfigTileLayerCatalog: pass catalog to GeoServerTileLayer constructor
  so getContextualName() can resolve workspace prefixes without NPE. The
  backend itself returns all layers unfiltered.

- GeoWebCacheCoreConfiguration: replaced inline SetRequestPathInfoFilter
  with the new GwcRequestPathInfoFilter bean.

- GeoWebCacheApplicationConfiguration: calls
  GwcRequestPathInfoFilter.adaptRequest() before the existing filter.

- GeoWebCacheUIAutoConfiguration: added gwcDemoUrlHandlerMapping and
  gwcRestWebUrlHandlerMapping beans using CloudGwcUrlHandlerMapping.

- RESTConfigConfiguration: use CloudGwcUrlHandlerMapping for the WMTS REST
  URL handler mapping.

Includes unit tests for GwcRequestPathInfoFilter and
CloudGwcUrlHandlerMapping.

Refs: geoserver#767, geoserver#766
groldan pushed a commit that referenced this pull request Mar 23, 2026
Backport the GWC virtual service URL fix from #767
(main branch) to release/2.28.x, adapted for Spring 5 / javax.servlet.

GWC virtual service URLs (e.g. /{workspace}/gwc/service/wmts,
/{workspace}/gwc/demo/...) were not properly handled in GeoServer Cloud.
The URL handler mapping and request path adaptation did not account for the
workspace prefix at the HTTP dispatch level.

New classes:

- GwcRequestPathInfoFilter: servlet filter that adapts HttpServletRequest
  for GWC path info handling. For /gwc/service/** paths, the workspace
  prefix is preserved in the request URI so LocalWorkspaceCallback can
  detect the workspace. For non-service paths (/gwc/demo, /gwc/rest), the
  workspace prefix is stripped so GeoWebCacheDispatcher.normalizeURL()
  works correctly.

- CloudGwcUrlHandlerMapping: extends GwcUrlHandlerMapping to fix virtual
  service URL matching with Spring's PathPattern-based request matching.
  Updates the cached parsed request path before delegation so
  workspace-prefixed URLs resolve to the correct controller.

Changes to existing classes:

- GeoServerTileLayerConfiguration: override getLayers() and getLayer() to
  filter by LocalWorkspace/LocalPublished thread-local context. This is the
  common TileLayerConfiguration decorator that wraps all backends, making it
  the correct abstraction level for virtual service filtering (analogous to
  upstream CatalogConfiguration.getTileLayerById()).

- PgconfigTileLayerCatalog: pass catalog to GeoServerTileLayer constructor
  so getContextualName() can resolve workspace prefixes without NPE. The
  backend itself returns all layers unfiltered.

- GeoWebCacheCoreConfiguration: replaced inline SetRequestPathInfoFilter
  with the new GwcRequestPathInfoFilter bean.

- GeoWebCacheApplicationConfiguration: calls
  GwcRequestPathInfoFilter.adaptRequest() before the existing filter.

- GeoWebCacheUIAutoConfiguration: added gwcDemoUrlHandlerMapping and
  gwcRestWebUrlHandlerMapping beans using CloudGwcUrlHandlerMapping.

- RESTConfigConfiguration: use CloudGwcUrlHandlerMapping for the WMTS REST
  URL handler mapping.

Includes unit tests for GwcRequestPathInfoFilter and
CloudGwcUrlHandlerMapping.

Refs: #767, #766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants