Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

http://localhost:8080/* breaks authenication #111

Closed
Goosaroo opened this issue Mar 22, 2017 · 11 comments
Closed

http://localhost:8080/* breaks authenication #111

Goosaroo opened this issue Mar 22, 2017 · 11 comments

Comments

@Goosaroo
Copy link

Hi all,

Great to see this new release with WkWebView.

We are running into a minor issue with our authentication provider, which throws an origin error: http://localhost:8080 is not allowed by Access-Control-Allow-Origin. Of course we could add it as a trusted source, however we would rather keep things tight from a security point of view.

So I am wondering why does this needs to be added to the config.xml and is there a way around it?

Cheers, G

@awebdeveloper
Copy link

as in the other post. domain as ionic.local is better

@Goosaroo
Copy link
Author

Goosaroo commented Mar 22, 2017

Hi @awebdeveloper,

You mean like? <allow-navigation href="ionic.local"/>

Couldn't make this up from the other post.

Cheers, G

@tanzl88
Copy link

tanzl88 commented Mar 22, 2017

Hi @awebdeveloper,

I resolved it by allowing CORS to localhost:8080 too. But as you said it is not recommended. I want to understand why origin is set to localhost:8080 instead of *. I don't understand what you meant by ionic.local as well.

@awebdeveloper
Copy link

i was refering to #3 (comment)

@peterpeterparker
Copy link

same here, on my server I get http://localhost:8080 as origin instead of ionic.local

app.use(function (req, res, next) {
    console.log(req.headers.origin); // => http://localhost:8080
}

@manucorporat
Copy link

I don't know what kind of security you are talking about, but the point of CORS is to prevent Cross Origin attacks:

For example, someone injects malicious code in your side that performs HTTP requests to a different domain. Read this: https://blog.cloudflare.com/an-introduction-to-javascript-based-ddos/

ionic.local is not less or more secure than localhost. Anyone can modify the /etc/hosts file.
C'mon! I can attack your site bypassing CORS completely if I use curl.

WK 3.0 used a local webserver, because it is the only solution that works for all the use cases.

@awebdeveloper
Copy link

OK agreed with all except para 2.

But y did u change from ionic.local to localhost

@manucorporat
Copy link

WKWebView is fully of little bugs, that makes it very difficult to use, localhost is the only solution that works for all use cases

@awebdeveloper
Copy link

Thanks @manucorporat. Now I understand why localhost.

Still don't think para 2 is correct. CSP is for para 2 . Cors is entirely server thing. Hacker could inject js and whitelist it on his server

@awebdeveloper
Copy link

I guess this can be closed

@Goosaroo Goosaroo closed this as completed Apr 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants