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 request require http or https protocol (app.js) #14

Closed
managai opened this issue Jan 26, 2020 · 4 comments
Closed

CORS request require http or https protocol (app.js) #14

managai opened this issue Jan 26, 2020 · 4 comments

Comments

@managai
Copy link

managai commented Jan 26, 2020

Hi,
I just downloaded zip archive, uncompressed it in folder and opened browser (firefox 72 and chromium 79) via file protocol

file:///$PATHTO/homer/index.html

both browser fail to open page and return a CORS related error located at
app.js:48
app.js:58

in firefox (68+) resing reason error is described at https://developer.mozilla.org/it/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp

some idea how to fix issue without having to edit browser settings ?

@m1cypher
Copy link

I am having the same issue. I am wondering if you need to put this on a server to have the apache/nginx engine to get it to work. I will attempt that this weekend.

@m1cypher
Copy link

Hi,
I just downloaded zip archive, uncompressed it in folder and opened browser (firefox 72 and chromium 79) via file protocol

file:///$PATHTO/homer/index.html

both browser fail to open page and return a CORS related error located at
app.js:48
app.js:58

in firefox (68+) resing reason error is described at https://developer.mozilla.org/it/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp

some idea how to fix issue without having to edit browser settings ?

Hey so running the homer on a apache2 server worked perfectly. I think that is what it meant. You'll have to create a virtual host to get it to work, but that is how I got it to work.

If you need some help with that I can help. Shoot me a message.

If you are trying to get it to work locally, I'd wait on him to respond.

@traeblain
Copy link
Contributor

Line 48 makes an HTTP HEAD request and line 58 is looking for an HTTP Status Code (i.e. 200). When opening from a file:// the requests are FILE request not HTTP requests. This is easily fixed by utilizing a simple HTTP server.

If you have python installed run in the directory:
python -m http.server 8000

If you would rather use node, then:
npm install http-server -g
then in the directory run:
npx http-server -p 8000

If you'd rather use PHP, then run in the directory:
php -S 127.0.0.1:8000

After all of these you just need to go to http://localhost:8000 and it should work.

You can also look at these depending upon your editor:
Visual Studio Code
SublimeText
Atom Editor
Brackets (Built-In)

Point is, you don't need apache/nginx/litespeed/caddy/etc. to dev this but do need something to handle HTTP requests.

@bastienwirtz
Copy link
Owner

Hi there,
Sorry for answering so late! As mentioned by @traeblain you need to have something to serve the files, assets & handle the CORS request. I'm afraid there is not really other workaround to that.

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

4 participants