Re-route/Divert some WL.Client Adapter Invocation traffic to WL Server through different URL (for PCI payment and security requirements)?

╄→гoц情女王★ 提交于 2019-11-28 14:44:07

Though possible, this is not something supported by WL. You will not be able to get help from support in case something goes wrong (and it will). You have to keep in mind that all server cookies (e.g. session id) are per domain. Therefore when you're dynamically changing server URL you will loose them. Therefore WL server will treat your request as a new session, unrelated to an old (existing) one. This is not something specific to WL, this is how HTTP works.

WL keeps server URLs in two global properties - WL.AppProp.WORKLIGHT_ROOT_URL and WL.AppProp.APP_SERVICES_URL. You can override them thus changing server URLs.

First one is used for all requests triggered by developer (init, connect, login etc). Second one is used for miscellaneous internal functionality (e.g. encrypted cache).

Once again - this is a hack, definitely not a solution. Use with caution if at all:)

How About this,if we define our own function that will call some static properties and update them ?

function changeServerUrl(serverURL) {

WL.StaticAppProps.APP_SERVICES_URL = serverURL + WL.StaticAppProps.POSTFIX_APP_SERVICES_URL; WL.StaticAppProps.WORKLIGHT_ROOT_URL = serverURL + WL.StaticAppProps.POSTFIX_WORKLIGHT_ROOT_URL; WL.StaticAppProps.WORKLIGHT_BASE_URL = serverURL; }

and call it

chnageServerUrl("http://"+yourServerIP+":"+PORT);

if you dig into the worklight.js file there is a function "setWLUrl(url)" that can be use to change the serevr URL. call it like this and its done

setWLUrl("http://"+yourServerIP+":PORT");

its kind a hack but i think it should not have anny issue since its a function within there api.

Good Luck

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!