【发布时间】:2018-01-26 00:42:56
【问题描述】:
似乎这里有很多 CORS 的东西。一百万种方法来处理它。
将应用程序转换为 Ionic。因为WKWebView
这似乎将代码作为 ios 上的本地主机运行。这实际上意味着我需要处理 CORS。
按照这个例子。 https://amodernstory.com/2014/12/27/using-cors-headers-with-java-example/
此时它只是 web.xml 有 CorsFilter 设置。 (默认)
我以为我必须在代码中做一些事情,但我添加的任何内容似乎都没有任何区别。
会发生什么,我登录了,然后我跟踪它,这似乎工作正常。 然后代码提取用户个人资料信息。这是一个单独的 Web 服务调用。 那是被阻塞了。
polyfills.js:3 POST [webserviceURL]/user/getUser 403 (Forbidden)
(index):1 Failed to load [webserviceURL]/user/getUser:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8100' is therefore not allowed access.
The response had HTTP status code 403.
第一次登录调用成功。第二个调用永远不会访问 Web 服务器。
不知道为什么。也许我需要告诉它记住起源?
【问题讨论】: