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

Auto rewrite urls to their CORS counterpart’s #4

Open
koenvo opened this issue Sep 14, 2022 · 3 comments
Open

Auto rewrite urls to their CORS counterpart’s #4

koenvo opened this issue Sep 14, 2022 · 3 comments

Comments

@koenvo
Copy link
Owner

koenvo commented Sep 14, 2022

Some common used urls like ‘github.com/…?raw=true’ don’t have CORS headers set. This will fail the request.

Luckily those urls can be rewritten to urls with CORS headers enabled. The ‘raw.githubusercontent.com’ has those headers enabled.

Three things need to be implemented:

  1. Generic way of rewriting urls
  2. User friendly api to enable this
  3. Rewriter for github (regex can be found here: simonw/datasette-lite@e7ccaf6 )

More context: https://mobile.twitter.com/simonw/status/1569835954365669376

@rth
Copy link
Contributor

rth commented Sep 15, 2022

Righ but this is only for GitHub essentially. For a lot of other resources there are equivalent urls with CORS headers sets. Unless you use a CORS proxy but that has privacy issues.

@koenvo
Copy link
Owner Author

koenvo commented Sep 15, 2022

Agree on the CORS proxy issues.

I'm also only aware of GitHub urls that can be replaced. Could you provide an example of other resources with CORS headers set?

@rth
Copy link
Contributor

rth commented Sep 15, 2022

Sorry, I mistyped, I meant "there are no equivalent URLs" :)

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

No branches or pull requests

2 participants