Worklight Adapter Override Origin of request

2019-08-02 16:48发布

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条回答
Ridiculous、
2楼-- · 2019-08-02 17:14

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.

查看更多
登录 后发表回答