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

Fix invalid virtual service endpoints not returning 404 #214

Merged

Conversation

groldan
Copy link
Member

@groldan groldan commented Mar 23, 2022

If an invalid virtual service request is made (e.g.
to a non existing workspace or layer), upstream
GeoServer will return a 404 thanks to OWSHandlerMapping
checking for the workspace/layergroup/layer and returning
a null request handler.

Spring-boot does not automatically engages the OWSHandlerMapping
beans in the request lifecycle.

This patch creates separate controller entry points for
/{virtualService}/<ows service> and
/{virtualService}/{layer}/<ows service>, using a helper
service bean to verify the existence of the requested
workspace/layergroup and layer, returning a 404 with
an explanatory message if the virtual service is not found,
and hence avoiding to return the full layer list in
getcapabilities requests instead.

Fixes #24

If an invalid virtual service request is made (e.g.
to a non existing workspace or layer), upstream
GeoServer will return a 404 thanks to `OWSHandlerMapping`
checking for the workspace/layergroup/layer and returning
a `null` request handler.

Spring-boot does not automatically engages the `OWSHandlerMapping`
beans in the request lifecycle.

This patch creates separate controller entry points for
`/{virtualService}/<ows service>` and
`/{virtualService}/{layer}/<ows service>`, using a helper
service bean to verify the existence of the requested
workspace/layergroup and layer, returning a 404 with
an explanatory message if the virtual service is not found,
and hence avoiding to return the full layer list in
getcapabilities requests instead.
@groldan groldan added the bug Something isn't working label Mar 23, 2022
@groldan groldan merged commit 444f87b into geoserver:main Mar 23, 2022
@groldan groldan deleted the bug/invalid_virtual_service_must_return_404 branch March 23, 2022 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request for non existent virtual workspace should return 404, returns all layers
1 participant