向ARR请求添加自定义标头 [英] Adding a custom header to ARR requests
问题描述
我正在使用ARR作为反向代理在IIS后面运行服务。我知道传递了 x-forwarded-for
和 x-arr-log-id
标头。但是,我想要的是传入的私钥,以便后备应用程序明确知道请求不是本地的(即使ARR服务器是)。我已经看到一些关于添加/替换服务器变量的帖子,但这似乎不是通过支持应用程序上的请求头来实现的。
I'm running a service behind IIS using ARR as a reverse proxy. I know there are x-forwarded-for
and x-arr-log-id
headers that are passed along. However, what I would like is a private key passed in so that the backing application explicitly knows that the request is not local (even though the ARR server is). I've seen some posts on adding/replacing server variables, but this doesn't seem to come through via the request headers on the backing application.
我猜必须有一些web.config设置,它会执行此操作,但到目前为止没有找到它的运气。
I'm guessing that there must be some web.config setting that will do this, but have had no luck finding it thus far.
示例: X-PRIVATE -TOKEN:我们是Korn的孩子!
这样我就可以信任 x-forwarded-for
地址是实际地址,而不是简单地不信任所有代理请求的IP地址引用。
So that I can trust the x-forwarded-for
address is the actual address, as opposed to simply distrusting all proxy request's ip address references.
推荐答案
尝试:
<rule name="myRule_01">
...
<serverVariables>
<set name="HTTP_X_PRIVATE_TOKEN" value="We are the children of Korn!" />
</serverVariables>
...
</rule>
http请求的标头字段为:x-private-token
The header field of the http request will be: x-private-token
这篇关于向ARR请求添加自定义标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!