生产服务器上的IBM Worklight 6.1 common / init 401(未经授权)循环错误 [英] IBM Worklight 6.1 common/init 401 (Unauthorized) looping error on production server
问题描述
在我的开发服务器上,一切正常,但一旦部署,然后尝试在浏览器上预览应用程序,我有一个循环的js错误说:
请求[/ MyApp / apps / services / api / MyApp / common / init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/ app / services / api / MyApp / common / init 401(未经授权)worklight.js:1081
请求[/ MyApp / apps / services / api / MyApp / common / init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401(未经授权)worklight.js:1081
请求[/ MyApp / apps / services / api / MyApp / common / init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401(未经授权)worklight.js:1081
编辑:
测试时,我有以下日志:
2014-05-19 08:00:44.318 MyApp [33533:a0b] DEBUG:请求[http://172.16.1.2:9080/MyApp/apps/services/api / MyApp / iphone / init]
2014-05-19 08:00:44。 336 MyApp [33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId - >从钥匙扣
返回UUID 2014-05-19 08:00:44.339 MyApp [33533:a0b] DEBUG:请求[http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone / init]
2014-05-19 08:00:44.348 MyApp [33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId - >从钥匙扣
返回UUID 2014-05-19 08:00:44.350 MyApp [33533:a0b] DEBUG:请求[http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone / init]
2014-05-19 08:00:44.356 MyApp [33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId - >从钥匙扣返回UUID
2014-05-19 08:00:44.360 MyApp [33533:a0b] DEBUG:请求[http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone / init]
(我从我的控制台部署了 http://172.16。 1.2:9080 / MyApp / console
我现在把现在的本地网络IP只是为了测试一切都可以了)
在我的服务器日志中找到任何信息
- 这些错误是什么?
- 我调试一下?
- 是否与网络问题有关?
我不知道为什么你收到这个日志行 3次(这听起来像一个问题),但是这个401本身并不是一个错误。
当应用程序向服务器发送一个 init
请求(通过使用 connectOnStartup:true
或 WL.Client.connect
,这是接收
当新会话启动时,对Worklight的最初请求
服务器将获得包含WL-Instance-Id令牌的HTTP 401响应。
工作灯框架将提取此令牌,并将其用作
的所有后续请求。
双重检查您的应用程序,您不使用 connectOnStartup
和 WL.Client.connect
;它是或 - 或还要检查你不要按顺序多次使用它。
I am using IBM Worklight 6.1 and trying to deploy on production server. On my development server, everything works fine, but once I deploy, and then try to preview the app on browser, I have a loop of js errors saying:
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Edit: When testing I have the following logs:
2014-05-19 08:00:44.318 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.336 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.339 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.348 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.350 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.356 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.360 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
(I deployed from my console http://172.16.1.2:9080/MyApp/console
and I am putting now my local network IP just to test that everything is OK)
And I haven't found any information in my server log
- What are these errors for?
- and how can I debug that?
- Is it related to Network issue?
I am not sure why you receive this log line 3 times (which sounds like a problem), however this 401 is not an error per-se on its own.
When an application sends an init
request to the server (by either using connectOnStartup:true
or WL.Client.connect
, it is the expected behavior to receive a single 401 response.
From "Understanding predefined Worklight authentication realms and security tests":
When new session is initiated the very first request to Worklight server will get a HTTP 401 response containing WL-Instance-Id token. Worklight framework will extract this token and use it as a header on all subsequent requests.
I would double check in your application that you do not use both connectOnStartup
and WL.Client.connect
; it is either-or. Also check you do not use it more than once in sequence.
这篇关于生产服务器上的IBM Worklight 6.1 common / init 401(未经授权)循环错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!