基本上我想使用反向代理重写 url: from:
http://www.xyz.in/eacc/api/fetchVendors
到
http://localhost:8080/eacc/api/fetchVendors
我已经在 C:\Tomcat\apache-tomcat-9.0.7\webapps\eacc 下的 tomcat 中部署了我的 Spring Boot Rest 完整 Web 服务应用程序。
它包含许多 POST 调用,如 /eacc/api/fetchVendors、/eacc/api/users、/eacc/api/clients.. 等。
现在我想通过 IIS 公开这个 eacc rest 应用程序。
配置了名为 www.xyz.in 的主网站。
在名为 /eacc 的网站 (www.xyz.in) 下添加了虚拟目录。物理路径:C:\inetpub\wwwroot\eacc 下面是 web.config 文件。
当我尝试打一个像www.xyz.in/eacc/api/fetchVendors这样的帖子调用时,得到 HTTP 404 服务器错误。
描述:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、更改名称或暂时不可用。请检查以下 URL 并确保其拼写正确。
请求的网址:/eacc/api/fetchVendors
我的/eacc 的web.config 文件- 虚拟目录
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" />
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:8080/eacc/{R:1}" />
</rule> …Run Code Online (Sandbox Code Playgroud)