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

WMTS imagery source is blocked by CORS policy while openlayer displays it #2471

Closed
airnez opened this issue Dec 2, 2024 · 1 comment
Closed
Assignees
Labels

Comments

@airnez
Copy link
Contributor

airnez commented Dec 2, 2024

Context

Some raster data (here WMTS) are getting their requests blocked by CORS policy. The same data can be displayed in openlayer without problems.

Steps to Reproduce

  1. Install the allow-cors extension in chrome
  2. Add this layer to the view_3d_map example :
            var wmtsSource = new itowns.WMTSSource({
                url: 'https://geo.pnrsud.fr/geoserver/gwc/service/wmts',
                crs: 'EPSG:3857',
                name: 'dynmap:scan25_1_paca_2022',
                tileMatrixSet: 'EPSG 3857',
                version: '1.0.0',
                style: 'raster',
                format: 'image/jpeg',
                isInverted: false,
                tileMatrixCallback: (zoomLevel) => 'EPSG 3857:' + zoomLevel
            });
  1. zoom to the french city "Alès"
  2. See that allowing CORS enables displaying the layer

image

@airnez airnez added the bug 🐛 label Dec 2, 2024
@airnez airnez assigned airnez and unassigned airnez Dec 2, 2024
@jailln jailln self-assigned this Dec 3, 2024
@jailln
Copy link
Contributor

jailln commented Dec 4, 2024

After analysis it turns out the cors error is legitimate since the server has no cors configuration for images (see https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image#web_server_configuration for an example of server configuration to allow cors on images)

@jailln jailln closed this as completed Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants