Iis 通过代理设置cookie

Iis 通过代理设置cookie,iis,proxy,Iis,Proxy,我在dev环境中使用代理,因为我想使用realdomain,同时使用仅在localhost上工作的“编辑并继续”功能 我已使用自定义主机在本地计算机上配置了www.site.com。(简单html页面) 我有一个应用程序:localhost:9090,它是我在本地pc上的asp.net mvc应用程序。 www.site.com通过ajax cors调用localhost:9090,但localhost无法使用域“.site.com”创建cookie 因此,我创建了:widgets.site.c

我在dev环境中使用代理,因为我想使用realdomain,同时使用仅在localhost上工作的“编辑并继续”功能

我已使用自定义主机在本地计算机上配置了
www.site.com
。(简单html页面)

我有一个应用程序:
localhost:9090
,它是我在本地pc上的asp.net mvc应用程序。
www.site.com
通过ajax cors调用
localhost:9090
,但localhost无法使用域“.site.com”创建cookie

因此,我创建了:
widgets.site.com
,其中自定义主机作为
localhost:9090的反向代理,因此我可以继续使用“编辑并继续”功能

我的本地主机如何将cookie设置为通配符域“.site.com”?(请记住,
widgets.site.com
localhost:9090
的代理)

这是反向代理:

<rewrite>   
    <rules>
        <rule name="ReverseProxyInboundRule1" stopProcessing="true">
            <match url="(.*)" />
            <action type="Rewrite" url="http://localhost:9090/{R:1}" />
          <conditions>
            <add input="{HTTP_COOKIE}" pattern="(.*)" />
          </conditions>
          <serverVariables>
            <set name="HTTP_ACCEPT_ENCODING" value="" />
            <set name="HTTP_COOKIE" value="{c:1}" />
          </serverVariables>
        </rule>
    </rules>
    <outboundRules>
        <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
            <match filterByTags="A, Form, Img" pattern="^http(s)?://widgets.site.com/(.*)" />
            <action type="Rewrite" value="http{R:1}://localhost/{R:2}" />
        </rule>
        <preConditions>
            <preCondition name="ResponseIsHtml1">
                <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
            </preCondition>
        </preConditions>
    </outboundRules>
</rewrite>

根据需要,您应该能够为
.domain.tld
设置Cookie
,并且它应该适用于
www.domain.tld
。然而,从我的测试来看,它似乎也适用于
domain.tld
(在firefox中)


另外,通过将
127.0.0.1 widgets.site.com
添加到
C:\Windows\System32\drivers\etc\hosts
|
/etc/hosts
,您可以完全跳过反向代理。然后你的机器会将
widgets.site.com
解析为
127.0.0.1

谢谢,如果我做了主机:
127.0.0.1 widgets.site.com
,我需要将项目设置配置为使用外部主机,然后,我会松开编辑并继续功能(这就是我发布问题的原因)。