Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Could you please explain why this isn't in Hapi by default? #2

Closed
taoeffect opened this issue Mar 28, 2016 · 6 comments
Closed

Could you please explain why this isn't in Hapi by default? #2

taoeffect opened this issue Mar 28, 2016 · 6 comments

Comments

@taoeffect
Copy link

I spent several hours trying to figure out how to get Hapi to simply respond to AJAX requests from localhost:8080 to localhost:3000, and never did figure it out. It was only by installing this thing that things started working.

I did not realize I was supposed to write 25 lines of code to get this simple behavior working. It would be great if this was a simple and clear thing to do in Hapi without additional plugins.

Also ref: outmoded/discuss#57 (comment)

@gr2m
Copy link
Owner

gr2m commented Mar 28, 2016

Hapi is a framework, which does very, very little out of the box. Enabling CORS with this plugin allows cross origin request with credentials from any domain, which is not allowed by default in CORS’ design. It’s cool because it works be default it works out of the box as you say, but it is potentially a security issue. You shouldn’t use it with simple cookie based authentication as it makes it super simple to steal a session from any domain. I’ll close this issue as it’s not a bug that needs fixing, but feel free to comment if you have another question

@gr2m gr2m closed this as completed Mar 28, 2016
@taoeffect
Copy link
Author

So, I get the part about the security issue, but why isn't it a simple config option in Hapi to say: allowedDomains: ['domain1.com', 'domain2.com']?

@gr2m
Copy link
Owner

gr2m commented Mar 28, 2016

¯_(ツ)_/¯

@taoeffect
Copy link
Author

Is that something that's relatively easy to implement?

If so could this plugin implement it?

@gr2m
Copy link
Owner

gr2m commented Apr 2, 2016

I honestly don’t know, best would be to discuss this in the hapi repository. I don’t know the inner working of hapi, I’m just a user myself :)

@taoeffect
Copy link
Author

@gr2m ok, per your suggestion i opened outmoded/discuss#262.

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

2 participants