Worklight适配器覆盖请求的来源 [英] Worklight Adapter Override Origin of request
问题描述
Worklight 6.1
Worklight 6.1
使用Chrome测试后端访问API,在一种情况下,需要覆盖Origin才能成功发出请求并避免状态403。
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.
在Worklight http适配器中实现相同的API我想覆盖Origin以避免
命中403.可以覆盖原点worklight http适配器。
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.
感谢您的时间和帮助
推荐答案
没有自己尝试,因为我没有应用程序正在做你正在做的事情,但你可以添加标头到适配器请求。所以,试试这个问题中描述的内容: IBM Worklight HTTP Adapter是否发送/支持发送User-Agent标头?
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);
其中foo:bar将是Origin标头及其值应该是什么。
Where foo:bar will be the Origin header and whatever its value should be.
这篇关于Worklight适配器覆盖请求的来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!