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 security error when running vscode live server in the browser #32

Open
bognar-dev opened this issue Sep 19, 2022 · 4 comments
Open

Comments

@bognar-dev
Copy link

Hallo, first of all thanks for this great api,
I tried to build a little app/website for my use and when I try to run it in the browser I get a Cross-Origin Resource Sharing (CORS) error.
Is there any solution to it?

@derhuerst
Copy link
Collaborator

If Deutsche Bahn's API used by db-prices doesn't have CORS enabled (maybe it does?), there is no easy fix for this. (This is the whole point of the CORS security model.)

You can either run db-prices on a server and expose it via a custom API. Or you can set up a CORS proxy specifically for the aforementioned API.

@simonhammes
Copy link

I tried to build a little app/website for my use

If you only need it to run on your own machine, you can install a browser extension to disable CORS.

@derhuerst
Copy link
Collaborator

If you only need it to run on your own machine, you can install a browser extension to disable CORS.

Note that, unless this browser extension only works for certain origins (more or less domains), this is highly discouraged! It will leave you exposed to various attacks, e.g. any page could query your Gmail inbox.

@simonhammes
Copy link

If you only need it to run on your own machine, you can install a browser extension to disable CORS.

Note that, unless this browser extension only works for certain origins (more or less domains), this is highly discouraged! It will leave you exposed to various attacks, e.g. any page could query your Gmail inbox.

You are correct. I should have added that warning myself.

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

3 participants