Skip to content Skip to sidebar Skip to footer

Using CORS Still Give Cross Origin Error

I'm trying to access a node route through angular $http using the cors module. I've tried a simple app.use(cors()); but still get the error. And I've tried adding from the cors d

Solution 1:

The problem here is that your client needs to make a request for the URL

http://localhost:8888/someroute/undefined

Instead, your client is making a request for

localhost:8888/someroute/undefined

which the browser interprets as a request for the host 8888 using the scheme localhost. However, localhost isn't a scheme that Chrome supports for CORS; only things like http, https, data are.

Somewhere, your client-side code does something like

xhr.send("localhost:8888/...")

but it needs a leading scheme, like http:// or https://.

Note that you get a similar error if you try to request a resource with a file or about scheme.


Post a Comment for "Using CORS Still Give Cross Origin Error"