Skip to content

Commit 9ae931c

Browse files
MalvozLeoColomb
andcommitted
Make disabling TRACE method usable in a .htaccess file (#169)
Co-authored-by: Léo Colombaro <[email protected]>
1 parent ad25d31 commit 9ae931c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/security/trace_method.conf

+8-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55
# Prevent Apache from responding to `TRACE` HTTP request.
66
#
77
# The TRACE method, while apparently harmless, can be successfully
8-
# leveraged in some scenarios to steal legitimate users' credentials
8+
# leveraged in some scenarios to steal legitimate users' credentials.
99
#
1010
# Modern browsers now prevent TRACE requests being made via JavaScript,
1111
# however, other ways of sending TRACE requests with browsers have been
1212
# discovered, such as using Java.
1313
#
14-
# (!) The `TraceEnable` directive will only work in the main server
15-
# configuration file, so don't try to enable it in the `.htaccess` file!
14+
# (!) If you have access to the main server configuration file, use the
15+
# `TraceEnable` directive instead.
1616
#
1717
# https://tools.ietf.org/html/rfc7231#section-4.3.8
1818
# https://www.owasp.org/index.php/Cross_Site_Tracing
1919
# https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006)
2020
# https://httpd.apache.org/docs/current/mod/core.html#traceenable
2121

22-
TraceEnable Off
22+
<IfModule mod_rewrite.c>
23+
RewriteEngine On
24+
RewriteCond %{REQUEST_METHOD} ^TRACE [NC]
25+
RewriteRule .* - [R=405,L]
26+
</IfModule>

0 commit comments

Comments
 (0)