AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-205583

nafmo's questions

Martin Hope
nafmo
Asked: 2018-12-15 05:47:55 +0800 CST

Apache 在 SSL 上忽略的 RewriteEngine 规则

  • 0

我在 CentOS 7.6 上使用标准的 Apache 2.4.6-88 包,使用 HTTP 有一个可用的 Apache 设置。我正在尝试在服务器上启用 HTTPS,一切正常,除了我的 RewriteEngine 规则。我在任何地方都找不到关于 mod_ssl 不支持 RewriteEngine 的任何提及。

我通过安装 mod_ssl 包启用了 HTTPS,而 Apache 现在在同一个设置中同时提供 HTTP 和 HTTPS。中有一个VirtualHost声明/etc/httpd/conf.d/ssl.conf,我没有碰过。我的配置的相关部分如下所示:

# Set up Apache proxying
ProxyRequests Off
ProxyPreserveHost Off

# URLs to handle locally
# Apache built-ins
ProxyPass /icons !
ProxyPassReverse /icons !

# Handle local URLs through Apache
RewriteEngine On
RewriteRule ^/$ /index.cgi [L]
RewriteRule ^/favicon.ico /ssg/favicon.cgi [L,R]

ProxyPass /ssg !
ProxyPassReverse /ssg !
ProxyPass /index.cgi !
ProxyPassReverse /index.cgi !
ProxyPass /robots.txt !
ProxyPassReverse /robots.txt !

# Hand off everything else to the Varnish backend, which will in turn
# forward to the appropriate backend server process.
ProxyPass / http://localhost:6081/ retry=0
ProxyPassReverse / http://localhost:6081/

代理部分工作,除了“ProxyPass!”列出的那些之外的所有 URL 规则被移交给 Varnish 后端。

但是,重写部分仅适用于 HTTP。所以http://myip/将重定向到http://myip/index.cgi和http://myip/favicon.ico到http://myip/ssg/favicon.cgi。在 HTTPS 上,它不起作用,而是被代理到 Varnish 后端(它会立即报告错误)。

我一定在这里遗漏了一些明显的东西,但我一生都无法弄清楚是什么。

启用非常详细的日志,似乎完全忽略了 RewriteRule 部分:

[Fri Dec 14 13:38:30.248204 2018] [core:trace5] [pid 90883] protocol.c(647): [client 10.0.30.15:54280] Request received from client: GET / HTTP/1.1
[Fri Dec 14 13:38:30.248282 2018] [ssl:debug] [pid 90883] ssl_engine_kernel.c(225): [client 10.0.30.15:54280] AH02034: Initial (No.1) HTTPS request received for child 21 (server fe80::c9d0:5dd9:c7ed:2045:443)
[Fri Dec 14 13:38:30.248297 2018] [http:trace4] [pid 90883] http_request.c(312): [client 10.0.30.15:54280] Headers received from client:
[Fri Dec 14 13:38:30.248301 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Host: 10.0.28.168
[Fri Dec 14 13:38:30.248303 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Connection: keep-alive
[Fri Dec 14 13:38:30.248305 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Cache-Control: max-age=0
[Fri Dec 14 13:38:30.248308 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Authorization: Digest username=\\"admin\\", realm=\\"Software Activation\\", nonce=\\"redacted\\", uri=\\"/\\", algorithm=MD5, response=\\"redacted\\", qop=auth, nc=0000002d, cnonce=\\"redacted\\"
[Fri Dec 14 13:38:30.248310 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Upgrade-Insecure-Requests: 1
[Fri Dec 14 13:38:30.248312 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.85 Safari/537.36 Vivaldi/2.2.1388.21
[Fri Dec 14 13:38:30.248315 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   DNT: 1
[Fri Dec 14 13:38:30.248316 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
[Fri Dec 14 13:38:30.248328 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Accept-Encoding: gzip, deflate, br
[Fri Dec 14 13:38:30.248383 2018] [http:trace4] [pid 90883] http_request.c(316): [client 10.0.30.15:54280]   Accept-Language: sv,en-US;q=0.9,en;q=0.8,nb;q=0.7
[Fri Dec 14 13:38:30.248513 2018] [authz_core:debug] [pid 90883] mod_authz_core.c(835): [client 10.0.30.15:54280] AH01628: authorization result: granted (no directives)
[Fri Dec 14 13:38:30.248542 2018] [core:trace3] [pid 90883] request.c(304): [client 10.0.30.15:54280] request authorized without authentication by access_checker_ex hook: /
[Fri Dec 14 13:38:30.248577 2018] [proxy_http:trace1] [pid 90883] mod_proxy_http.c(60): [client 10.0.30.15:54280] HTTP: canonicalising URL //localhost:6081/
[Fri Dec 14 13:38:30.248640 2018] [proxy:trace2] [pid 90883] proxy_util.c(1985): [client 10.0.30.15:54280] http: found worker http://localhost:6081/ for http://localhost:6081/
[Fri Dec 14 13:38:30.248657 2018] [proxy:debug] [pid 90883] mod_proxy.c(1123): [client 10.0.30.15:54280] AH01143: Running scheme http handler (attempt 0)
apache-2.4
  • 1 个回答
  • 608 Views
Martin Hope
nafmo
Asked: 2014-01-16 03:44:25 +0800 CST

Apache2:使用符号链接的目标名称进行内容类型映射

  • 1

我正在开发一个 Web 应用程序,该应用程序需要在静态 URL 上提供许多不断更新的文档,但是文档的 Content-Type 不同(它是 JPEG 或 SVG)。如果文档是符号链接,则链接末尾的文件具有 MIME 类型映射的正确文件扩展名,但我无法确定是否可以在查找扩展名之前让 Apache 跟随链接在 MIME 表中。

这个问题问同样的问题,但提供的解决方法对我不起作用,因为如果我提供图像/jpeg(它们会自动检测 GIF 和 PNG),浏览器不会自动检测 SVG,所以我需要一个正确的 MIME 类型。

通常,我会为此使用 .meta 文件和mod_cern_meta,但我的目标 Linux 发行版(Fedora 19/20,RHEL 7)不附带这个,我想避免自己提供它。我认为我不能使用 mod_headers,因为它需要我重写整个 .htaccess 文件(这些文件是单独更改的),也不能使用 mod_asis,因为数据文件本身是使用第三方工具生成的。

编辑:我正在通过将我的文件编写为类型映射(只有一个条目)、指向实际资源并列出其 Content-Type 来解决这个问题。这意味着必须编写额外的文件,但使用 mod_meta 也是如此。暂时工作得很好。

apache-2.2
  • 2 个回答
  • 604 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve