实现类似nginx的azure application gateway反向代理能力

achieve azure application gateway reverse proxy capability similar to nginx

目前我不认为 Azure 应用程序网关 (WAF V2) 具有像专用 nginx VM 这样的反向代理功能,它从后端或某些外部网站获取数据并在前端显示内容 URL在 URL 栏中没有变化。

例如 代理来自 https://www.abcd.com/test to get a response from backend (or external website) at https://example.com and display the content from https://example.com at https://www.abcd.com/test

的所有请求

abcd.com 例如是一个 Azure 网络应用程序,example.com 是我们希望显示其内容的第三方。

或者我错了,我们确实有一些方法可以只用一个应用程序网关来实现这个目标?

为此,我们设置了一个 nginx VM,并将其添加为 Azure 应用程序网关中的后端池。我们添加了一个规则来检测和应用基于路径的“/test”重定向,并向它发送一个后端池,该池具有我们设置的 nginx VM 的 IP 地址。

那里的nginx配置如下:

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://example.com/;
proxy_buffering off;

有人知道我们如何使用应用程序网关中的重写集来实现这一点,而不是使用 nginx VM 来实现这一点,或者我们应该坚持使用 nginx,而 Azure 应用程序网关还不支持该功能?

根据 https://docs.microsoft.com/en-us/azure/application-gateway/rewrite-url-portal,尽管应用程序网关旨在用作反向代理,但不幸的是,目前无法实现该功能。你最好的选择仍然是 Nginx。