需要在 Apache 上允许编码斜杠 [英] Need to allow encoded slashes on Apache

查看:17
本文介绍了需要在 Apache 上允许编码斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在 URL 中放置一个 URL.例如:

I'm currently trying to place a URL within a URL. For example:

http://example.com/url/http%3A%2F%2Fwww.url2.com

我知道我必须对 URL 进行编码,我已经完成了,但现在我从服务器而不是我的应用程序收到了 404 错误.我认为我的问题出在 apache 上,可以使用 AllowEncodedSlashes On 指令修复.

I'm aware that I have to encode the URL, which I have done, but now I am getting a 404 error back from the server rather than my app. I think my problem lies with apache and can be fixed with the AllowEncodedSlashes On directive.

我已经尝试将指令放在 httpd.conf 的底部无效,但我不确定接下来要做什么.我把它放在正确的地方了吗?如果是这样,有人有其他解决方案吗?

I've tried putting the directive at the bottom of the httpd.conf to no effect, and am unsure what to do next. Am I putting it in the right place? If so, does anyone have any other solutions?

推荐答案

此问题与 Apache 错误 35256 无关.而是与错误 46830 相关.AllowEncodedSlashes 设置不会被继承虚拟主机,虚拟主机用于许多默认的 Apache 配置,例如 Ubuntu 中的配置.解决方法是在 容器中添加 AllowEncodedSlashes 设置(/etc/apache2/sites-available/default 在 Ubuntu 中).

This issue is not related to Apache Bug 35256. Rather, it is related to Bug 46830. The AllowEncodedSlashes setting is not inherited by virtual hosts, and virtual hosts are used in many default Apache configurations, such as the one in Ubuntu. The workaround is to add the AllowEncodedSlashes setting inside a <VirtualHost> container (/etc/apache2/sites-available/default in Ubuntu).

错误 35256:%2F将在 PATH_INFO 中解码(AllowEncodedSlashes 的文档说不会进行解码)

Bug 35256: %2F will be decoded in PATH_INFO (Documentation to AllowEncodedSlashes says no decoding will be done)

错误 46830:如果 AllowEncodedSlashes On 在全局上下文中设置,它不会被虚拟主机继承.您必须在每个 容器中明确设置 AllowEncodedSlashes On.

Bug 46830: If AllowEncodedSlashes On is set in the global context, it is not inherited by virtual hosts. You must explicitly set AllowEncodedSlashes On in every <VirtalHost> container.

有关如何合并不同配置部分的文档说:

The documentation for how the different configuration sections are merged says:

部分内的部分应用在虚拟主机定义之外的相应部分之后.这允许虚拟主机覆盖主服务器配置.

Sections inside <VirtualHost> sections are applied after the corresponding sections outside the virtual host definition. This allows virtual hosts to override the main server configuration.

这篇关于需要在 Apache 上允许编码斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆