Skip to content

Commit bf163ca

Browse files
committed
Send X-Frame-Options header only for web pages
Sending the `X-Frame-Options` header for everything by default, doesn't bring any value when it comes to providing clickjacking protection. Even if some developers may want to send this header for some other content (e.g. images) to block websites from using it, for the majority, that won't be the case. Ref: #8 #9
1 parent fa83e20 commit bf163ca

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.htaccess

+13-5
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,23 @@ AddDefaultCharset utf-8
258258

259259
# Protect web site against clickjacking.
260260

261-
# Options available:
262-
# SAMEORIGIN: The page can only be displayed in a frame on the same origin as the page itself.
263-
# DENY: The page cannot be displayed in a frame, regardless of the site attempting to do so.
264-
# ALLOW-FROM uri This setting will allow page to be displayed only on the specified origin.
261+
# The example below sends the `X-Frame-Options` response header with the value
262+
# `SAMEORIGIN`, informing browsers not to display the web page content in any
263+
# frame from a page of different origin than the content itself.
265264

266-
# More info: https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
265+
# This might not be the best setting for everyone. You should read about the
266+
# other two possible values for `X-Frame-Options`: `DENY` and `ALLOW-FROM`.
267+
# http://tools.ietf.org/html/rfc7034#section-2.1.
268+
269+
# http://tools.ietf.org/html/rfc7034
270+
# http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx
271+
# https://www.owasp.org/index.php/Clickjacking
267272

268273
# <IfModule mod_headers.c>
269274
# Header set X-Frame-Options "SAMEORIGIN"
275+
# <FilesMatch "\.(appcache|crx|css|cur|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
276+
# Header unset X-Frame-Options
277+
# </FilesMatch>
270278
# </IfModule>
271279

272280
# ------------------------------------------------------------------------------

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### HEAD
22

3+
* Add example on how to provide clickjacking protection ([#8](https://github.com/h5bp/server-configs-apache/issues/8)).
34
* Add example on how to reduce MIME type security risks ([#8](https://github.com/h5bp/server-configs-apache/issues/8)).
45
* Add configs for cursor images (`.cur`).
56
* Fix backup and source file blocking for Apache v2.3+ ([#5](https://github.com/h5bp/server-configs-apache/issues/5)).

0 commit comments

Comments
 (0)