laravel 在 CORS 中真的需要 Angular $http.defaults.useXDomain 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23147196/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it Angular $http.defaults.useXDomain really neccessary in CORS?
提问by under5hell
I saw someone using $http.defaults.useXDomain = true in angular when dealing with CORS. Is it really necessary to do that?
我看到有人在处理 CORS 时在 angular 中使用 $http.defaults.useXDomain = true 。真的有必要这样做吗?
I just set up laravel and angular in different domain ( By different domain, I mean I put angular and laravel in completely separated folder in localhost www folder. FYI i use nginx). i hit the laravel controller with http request from angular. It just work fine, Whether i use the $http.defaults.useXDomain or not.
我只是在不同的域中设置了 laravel 和 angular(通过不同的域,我的意思是我将 angular 和 laravel 放在 localhost www 文件夹中完全分离的文件夹中。仅供参考,我使用 nginx)。我用来自angular的http请求点击了laravel控制器。无论我是否使用 $http.defaults.useXDomain,它都能正常工作。
Luckily, this condition make my work little bit easier. but i still wondering is there any explanation why this happened?
幸运的是,这种情况使我的工作更容易一些。但我仍然想知道为什么会发生这种情况有什么解释吗?