简体   繁体   English

在Apache 2.4中进行身份验证,重定向到HTTPS和重写url

[英]Authenticate, Redirect to HTTPS and Rewrite url in Apache 2.4

I am running a Python http server (Waitress) behind an Apache 2.4 web server. 我在Apache 2.4 Web服务器后面运行Python http服务器(Waitress)。 I have a rewrite rule to make Apache actually access an internal port (55555) in my system (the port that Waitress serves). 我有一个重写规则,以使Apache实际访问系统中的内部端口(55555)(Waitress服务的端口)。 This works well. 这很好。 Waitress cannot serve HTTPS. 服务生无法提供HTTPS。

But now I need two more things: force users to always use HTTPS and authenticate users with Apache's own AuthType Basic . 但是现在我还需要两件事:强制用户始终使用HTTPS并使用Apache自己的AuthType Basic验证用户身份。 Is it possible to have all these three things together? 是否可以将所有这三件事放在一起? This "double redirection"! 这个“双重重定向”!

Should happen in this order: 应按以下顺序发生:

  1. Redirect all http calls to equivalent https address. 将所有http调用重定向到等效的https地址。
  2. Force authentication 强制认证
  3. Rewrite/redirect to Waitress port 重写/重定向到服务员端口
  1. How to redirect all HTTP requests to HTTPS 如何将所有HTTP请求重定向到HTTPS
  2. If your http server requests auth, it should be the case when rewritten too, but it will need to be handle on the Waitress side 如果您的http服务器要求进行身份验证,那么在重写时也应该如此,但是需要在服务员端进行处理
  3. You already do that. 您已经做到了。 To be more precise, you will need to add the rewrite rules from point 1 before your existing ones. 更精确地说,您将需要在第1点之前添加重写规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM