linux - http 重定向 azure Web 应用程序

标签 linux azure-web-app-service tomcat9

我的公司有一个运行 tomcat 9.0 的 azure linux Web 应用程序。

我需要设置 http 307 重定向以将其定向到另一个网站(未托管在 azure 上)。

我看到这篇关于如何在网络应用程序上进行重定向的文章: https://michelebusta.com/azure-tip-just-a-web-app-with-redirect-please-a045d1072659

但我认为这篇文章仅适用于 Windows 实例。

如何在 Linux 中运行的 Web 应用程序上实现此目的?

最佳答案

要在 Apache Linux Web 应用程序上完成 URL 重写,您可以按照以下过程进行操作。

  1. 在您网站的/home/site/wwwroot/中创建一个 htaccess 文件。
  2. 使用mod_rewrite module制定如下类似的规则。下面的例子是rewriting URLs from HTTP to HTTPS .

    • RewriteEngine 开启
    • RewriteCond %{HTTP:X-ARR-SSL} ^$
    • 重写规则 ^(.*)$ https://% {HTTP_HOST}%{REQUEST_URI} [L,R=301]

关于linux - http 重定向 azure Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56149316/

相关文章:

linux - 为什么这个 Linux 内核页表代码将返回值用大括号括起来?

python - Linux环境下如何设置sublime text 2的sublimecodeintel?

tomcat - Certbot 错误 - 类型 : unauthorized, 抛出 404。Tomcat 9 + Ubuntu 18.04

java - 服务 tomcat9 在 Ubuntu 18.04 中无法运行

java - 使用 java.net.InetAddress.getLocalHost 查找主机名时线程进入阻塞状态

linux - 如何让 SSH 命令中的本地变量和远程变量在本地可用

linux - SO_BINDTODEVICE 虚拟接口(interface)失败

azure - 名称服务器 ns3-02.azure-dns.org。应该采用正确的格式

azure - Azure Web 应用程序请求的资源中不存在 'Access-Control-Allow-Origin' header

azure - 使用发布管道将.NET Core 3.0 API部署到Azure Web App