Worklight Adapter Override Origin of request

不打扰是莪最后的温柔 提交于 2019-12-24 13:32:08

问题


Worklight 6.1

Using Chrome to test backend access API's and in one scenario the ability to override the Origin is needed to successfully issue the request and avoid a status 403.

Implementing the same API in a Worklight http adapter I would like to override the Origin to avoid hitting a 403. It is possible to override the Origin in a worklight http adapter.

Thanks for your time and help


回答1:


Did not try this myself as I don't have an application doing what that yours is doing, but you can add headers to adapter requests. So, try what that is described in this question: Does the IBM Worklight HTTP Adapter send/support sending a User-Agent header?

var input = {
    method : 'get',
    headers: {foo: 'bar'},
    path : '/mypath'
};  
return WL.Server.invokeHttp(input);

Where foo:bar will be the Origin header and whatever its value should be.



来源:https://stackoverflow.com/questions/25574804/worklight-adapter-override-origin-of-request

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