Skip to content

Commit b20558d

Browse files
committed
Merge remote-tracking branch 'ogresCE/MAGETWO-43510-x-frame' into PR_Branch
2 parents 4794d79 + 2a3e707 commit b20558d

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

nginx.conf.sample

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ location /setup {
3939
location ~ ^/setup/(?!pub/). {
4040
deny all;
4141
}
42+
43+
location ~ ^/setup/pub/ {
44+
add_header X-Frame-Options "SAMEORIGIN";
45+
}
4246
}
4347

4448
location /update {
@@ -55,6 +59,10 @@ location /update {
5559
location ~ ^/update/(?!pub/). {
5660
deny all;
5761
}
62+
63+
location ~ ^/update/pub/ {
64+
add_header X-Frame-Options "SAMEORIGIN";
65+
}
5866
}
5967

6068
location / {
@@ -66,6 +74,7 @@ location /pub {
6674
deny all;
6775
}
6876
alias $MAGE_ROOT/pub;
77+
add_header X-Frame-Options "SAMEORIGIN";
6978
}
7079

7180
location /static/ {
@@ -74,6 +83,7 @@ location /static/ {
7483
}
7584
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
7685
add_header Cache-Control "public";
86+
add_header X-Frame-Options "SAMEORIGIN";
7787
expires +1y;
7888

7989
if (!-f $request_filename) {
@@ -82,6 +92,7 @@ location /static/ {
8292
}
8393
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
8494
add_header Cache-Control "no-store";
95+
add_header X-Frame-Options "SAMEORIGIN";
8596
expires off;
8697

8798
if (!-f $request_filename) {
@@ -91,6 +102,7 @@ location /static/ {
91102
if (!-f $request_filename) {
92103
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
93104
}
105+
add_header X-Frame-Options "SAMEORIGIN";
94106
}
95107

96108
location /media/ {
@@ -102,14 +114,17 @@ location /media/ {
102114

103115
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
104116
add_header Cache-Control "public";
117+
add_header X-Frame-Options "SAMEORIGIN";
105118
expires +1y;
106119
try_files $uri $uri/ /get.php?$args;
107120
}
108121
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
109122
add_header Cache-Control "no-store";
123+
add_header X-Frame-Options "SAMEORIGIN";
110124
expires off;
111125
try_files $uri $uri/ /get.php?$args;
112126
}
127+
add_header X-Frame-Options "SAMEORIGIN";
113128
}
114129

115130
location /media/customer/ {

pub/.htaccess

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,9 @@
208208
order allow,deny
209209
deny from all
210210
</Files>
211+
212+
<IfModule mod_headers.c>
213+
############################################
214+
## prevent clickjacking
215+
Header set X-Frame-Options SAMEORIGIN
216+
</IfModule>

setup/pub/.htaccess

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<IfModule mod_headers.c>
2+
############################################
3+
## prevent clickjacking
4+
Header set X-Frame-Options SAMEORIGIN
5+
</IfModule>

setup/src/Magento/Setup/Module.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function onBootstrap(EventInterface $e)
4949
$headers->addHeaderLine('Cache-Control', 'no-cache, no-store, must-revalidate');
5050
$headers->addHeaderLine('Pragma', 'no-cache');
5151
$headers->addHeaderLine('Expires', '1970-01-01');
52+
$headers->addHeaderLine('X-Frame-Options: SAMEORIGIN');
5253
}
5354
}
5455
}

0 commit comments

Comments
 (0)