您好,这个问题需要这样操作,首先你需要安装一个 URL的重写
下载地址:https://www.iis.net/downloads/microsoft/url-rewrite
这样安装之后,需要再进行一个WebConfig报表的配置:
放在 <system.webServer>中
- <rewrite>
- <outboundRules>
- <rule name="AddCrossDomain">
- <match serverVariable="RESPONSE_Access_Control_Allow_Origin" pattern=".*" />
- <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
- <add input="{HTTP_ORIGIN}" pattern="http://localhost:59032|http://10.32.1.251:6060" />
- </conditions>
- <action type="Rewrite" value="{C:0}" />
- </rule>
- </outboundRules>
- </rewrite>
- <httpProtocol>
- <customHeaders>
- <add name="Access-Control-Allow-Headers" value="Access-Control-Allow-Headers, Origin,Accept,Expires, X-Requested-With,Cache-Control,Content-Type,Pragma,Access-Control-Request-Method, Access-Control-Request-Headers" />
- <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" />
- <add name="Access-Control-Allow-Credentials" value="true" />
- </customHeaders>
- </httpProtocol>
复制代码
|