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

PROJJSON Schema redirect / CORS issues #4088

Closed
m-mohr opened this issue Mar 14, 2024 · 16 comments
Closed

PROJJSON Schema redirect / CORS issues #4088

m-mohr opened this issue Mar 14, 2024 · 16 comments
Labels

Comments

@m-mohr
Copy link

m-mohr commented Mar 14, 2024

Until some time ago the PROJJSON schema could be found directly at:
https://proj.org/schemas/v0.5/projjson.schema.json
It's also still the old $id. The PROJ documentation also still refers to this URL (it's another version number, but the issue is the same):
https://proj.org/en/9.4/specifications/projjson.html
[Note: The page points to 0.6 although it seems 0.7 is available?!]

It seems this has changed and now it redirects to:
https://proj.org/en/latest/schemas/v0.5/projjson.schema.json

We've embedded the old URLs in published, versioned specifications such as for STAC and GeoParquet.
Our browser-based STAC tooling can't load the PROJJSON schemas anymore.
The issue seems to be that the old URL doesn't send CORS headers any more.
We'd need to release a new version of the STAC specification to fix the issue with new schema URLs. We'd like to avoid that.

Could CORS for the old URLs be enabled again, please?
[Also, I'm not sure whether the redirect is intentional?]

@rouault
Copy link
Member

rouault commented Mar 14, 2024

https://proj.org/en/9.4/specifications/projjson.html

Ah that's an oversight. Just updated to https://proj.org/schemas/v0.7/projjson.schema.json per 5f725fb (master branch) and 0caf671 (9.4 branch)

Regarding CORS issues, I'm not familiar with that. The thing is that now we use ReadTheDocs versionned docs, and no longer a static (single version) github hosted website. And so we have a global redirect from /{foo} to /en/latest/{foo} in the ReadTheDocs settings. CC'ing @mwtoews if he has some clues on what we could do.

An alternative would be that you and us now reference https://proj.org/en/latest/schemas/v0.7/projjson.schema.json as the official URL (assuming it has the CORS headers?)

@rouault
Copy link
Member

rouault commented Mar 14, 2024

wondering if using RTD sub-projects (https://docs.readthedocs.io/en/stable/subprojects.html) couldn't be a solution. If we had a "schemas" sub-project, only fed from master builds, that might perhaps do it

@mwtoews
Copy link
Member

mwtoews commented Mar 15, 2024

One solution is to use the replacements extension that uses a mapping configuration which is used in a few places like here. This would require this one variable PROJJSONVERSION to be configured in conf.py with notes to maintain it for each release.

@rouault
Copy link
Member

rouault commented Mar 15, 2024

One solution is to use the replacements extension that uses a mapping configuration which is used in a few places like here. This would require this one variable PROJJSONVERSION to be configured in conf.py with notes to maintain it for each release.

@mwtoews Not sure to follow you. How would that help having https://proj.org/schemas/v0.7/projjson.schema.json to be a CORS friendly URL? What you propose if I've understood would be more to help keeping track of the latest version of the projjson spec, but hopefully it won't change very frequently at that point.

@m-mohr
Copy link
Author

m-mohr commented Mar 15, 2024

An alternative would be that you and us now reference https://proj.org/en/latest/schemas/v0.7/projjson.schema.json as the official URL (assuming it has the CORS headers?)

Unfortunately, we can't update released specification schemas. We can do that in new versions, but STAC 1.0.0 and GeoParquet 1.0.0 will both keep referencing the old version and will fail forever. As such I'd be happy if a solution could be found.

An alternative would be that you and us now reference https://proj.org/en/latest/schemas/v0.7/projjson.schema.json as the official URL (assuming it has the CORS headers?)

Yes, it has.

The other question is, is it really good if the schemas are versioned twice / available at dozens of locations?
-> https://proj.org/en/9.4/schemas/v0.5/projjson.schema.json
-> https://proj.org/en/9.3/schemas/v0.5/projjson.schema.json
-> https://proj.org/en/latest/schemas/v0.5/projjson.schema.json
-> ...

Which shall a user use? Maybe the schemas should not live within the versioned documentation and be hosted separately?

@rouault
Copy link
Member

rouault commented Mar 15, 2024

is it really good if the schemas are versioned twice?

Well, that hasn't been specifically designed. That's a consequence of having the versioning of the schemas in the /schemas of the git repo (https://github.com/OSGeo/PROJ/tree/master/schemas), and deploying it when building the documentation of a given branch. As RtD adds versioning of the PROJ branches on top of that, you get those 2 levels of versioning.

Referencing to the /latest/is most certainly preferable, in the hopefully unlikely case there would be a need to patch a released version of the schema, instead of publishing a new one.

But maybe we can find a solution to have back the old URL in a CORS friendly way. We just need to figure out if that's possible.

In brainstorming mode: https://raw.githubusercontent.com/OSGeo/PROJ/master/schemas/v0.7/projjson.schema.json is also a candidate CORS compatible URL, but less "good looking".

@m-mohr
Copy link
Author

m-mohr commented Mar 15, 2024

Thanks, but the new URLs have CORS. The issue is that the old URLs are baked into specs and can't really be changed. As such the only solution can be that the old URLs get CORS support, and/or we remove the rediect for the schemas and/or we move the files back to the original place. The alternative is leaving it broken, but I hope there's a better solution. A new URL variant wouldn't help due to the reason given above.

What's responsible for the redirects? We need to hook into there, I think.

@rouault
Copy link
Member

rouault commented Mar 15, 2024

What's responsible for the redirects? We need to hook into there, I think.

This is this RtD mechanism: https://docs.readthedocs.io/en/stable/user-defined-redirects.html#user-defined-redirects
In https://readthedocs.org/dashboard/osgeo-proj/redirects/20195/edit/ we have setup an "exact redirect" from /schemas/* to /en/latest/schemas/:splat using HTTP 302. What is done underneath is somewhere in the RtD sources... Probably somewhere in https://github.com/readthedocs/readthedocs.org/tree/main/readthedocs/redirects

@rouault
Copy link
Member

rouault commented Mar 15, 2024

I've filed an issue at RtD at readthedocs/readthedocs.org#11223 . Let's see if we get some response

@m-mohr
Copy link
Author

m-mohr commented Mar 15, 2024

I was about to do the same, thank you @rouault!

@rouault
Copy link
Member

rouault commented Mar 15, 2024

still in brainstorming mode... Given that the desired resource is /schemas/v0.7/projjson.schema.json, this could ressemble the RTD versioning scheme used for PROJ content (/{language}/{version}/foo) if we'd use language=schemas and version=v0.7. But that looks super messy and not sure we can invent an arbitrary language name and somehow mix PROJ versions with schema versions.

m-mohr added a commit to stac-utils/stac-node-validator that referenced this issue Mar 15, 2024
@jorisvandenbossche
Copy link
Contributor

wondering if using RTD sub-projects (https://docs.readthedocs.io/en/stable/subprojects.html) couldn't be a solution. If we had a "schemas" sub-project, only fed from master builds, that might perhaps do it

Personally, this seems like a nice solution?
That should allow to restore the actual URLs without any redirection, and also keeps the URLs somewhat more independent from the readthedocs versioning scheme if also for future versions of the spec we keep using the old URL structure (you never know if in the future the hosting of the docs is again migrated)

@rouault
Copy link
Member

rouault commented Mar 25, 2024

Personally, this seems like a nice solution?

actually, looking at https://docs.readthedocs.io/en/stable/subprojects.html, I think it is a wrong track as URLs are like https://docs.example.com/projects/{subproject_name}/en/latest/, so that wouldn't help

@jorisvandenbossche
Copy link
Contributor

Ah, indeed, all the examples indeed include "projects" as first part of the url after the main domain ..

@rouault
Copy link
Member

rouault commented Mar 26, 2024

@m-mohr If readthedocs/readthedocs.org#11223 fixes your issue, we can close this issue, right?

m-mohr added a commit to stac-utils/stac-node-validator that referenced this issue Mar 26, 2024
@m-mohr
Copy link
Author

m-mohr commented Mar 26, 2024

Indeed, this works fine now. Thanks a lot!

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

4 participants