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

CORS Pre-flight OPTIONS request #35

Open
dschep opened this issue Nov 8, 2024 · 3 comments
Open

CORS Pre-flight OPTIONS request #35

dschep opened this issue Nov 8, 2024 · 3 comments

Comments

@dschep
Copy link

dschep commented Nov 8, 2024

Hi! When I initially added SPARQL support to Ultra, I used POST requests sending the query as the body and a Content-Type: application/sparql-query header. This works great with the Wikidata Query Service and QLever.

This is a valid means of calling SPARQL per the protocol: https://www.w3.org/TR/sparql11-protocol/#query-operation

Sophox also works with this invocation method when using curl, however it doesn't work in the browser because Sophox doesn't support CORS Preflight requests.

@dschep dschep changed the title CORS headers for overpass-ultra.us CORS Pre-flight OPTIONS request Nov 15, 2024
@dschep
Copy link
Author

dschep commented Nov 15, 2024

I dug in a bit more, and the issue is that /sparql returns 404 for an OPTIONS request, which CORS requests from other domains must use for a preflight request.

@dschep
Copy link
Author

dschep commented Nov 15, 2024

from overpass-ultra.us (or realistically, any domain other than sophox.org)
image

vs from sophox.org, which being on the same domain, does not make a preflight OPTIONS request.
image

@dschep
Copy link
Author

dschep commented Dec 9, 2024

I figured out a solution to Sophox not supporting CORS Preflight requests: Don't send one 😅

namely, use a GET request or a form encoded POST request with Content-Type: application/x-www-form-urlencoded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant