by greenhem

# ググったけど、日本語での情報がなかったので書いておく。

Apacheでは「Apacheでパラメータに「%2F」(/の符号化文字列)が含まれていると404(Not Found)が返される」のエントリで書いた通り、"AllowEncodedSlashes"ディレクティブを利用することで、符号化された"/"(スラッシュ)文字「%2F」を扱うことが出来ます。

これは、Railsアプリケーションを稼動させているApache + Passenger環境でも可能なわけですが、Passengerのバージョン2.2.5以降では、以下のPassengerの設定「PassengerAllowEncodedSlashes」もあわせて記述する必要があります。

PassengerAllowEncodedSlashes on


Is it important that you turn on both AllowEncodedSlashes and PassengerAllowEncodedSlashes, otherwise this feature will not work properly.

5.13.2. PassengerAllowEncodedSlashes - Phusion Passenger users guide


  • In the global server configuration.
  • In a virtual host configuration block.
  • In a or block.
  • In .htaccess, if AllowOverride Options is on.
5.13.2. PassengerAllowEncodedSlashes - Phusion Passenger users guide


[Apache] Fixed support for mod_rewrite passthrough rules

Mod_rewrite passthrough rules were not properly supported because of a bug fix for supporting encoded slashes (%2f) in URLs. Unfortunately, due to bugs/limitations in Apache, we can support either encoded slashes or mod_rewrite passthrough rules, but not both; supporting one will break the other.
Support for mod_rewrite passthrough rules is now enabled by default; that is, support for encoded slashes is disabled by default. A new configuration option, PassengerAllowEncodedSlashes, has been added. Turning this option on will enable support for encoded slashes and disable support for mod_rewrite passthrough rules.

Phusion Passenger 2.2.5 released - Phusion Blog