Skip to content

Commit 46050ef

Browse files
author
Till Brehm
committed
Merge branch '5815-goaccess-stats-blocked-by-content-security-policy-nginx' into 'develop'
Resolve "GoAccess stats blocked by Content Security Policy (nginx)" Closes #5815 See merge request ispconfig/ispconfig3!1265
2 parents 8419da8 + 6eede43 commit 46050ef

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/conf/nginx_vhost.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ server {
169169
index index.html index.php;
170170
auth_basic "Members Only";
171171
auth_basic_user_file <tmpl_var name='stats_auth_passwd_file'>;
172-
add_header Content-Security-Policy "default-src * 'self' 'unsafe-inline';";
172+
add_header Content-Security-Policy "default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;";
173173
}
174174

175175
location ^~ /awstats-icon {

server/plugins-available/apache2_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,7 @@ function update($event_name, $data) {
19571957

19581958
if($data['new']['stats_type'] != '') {
19591959
if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
1960-
$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user\nDirectoryIndex index.html index.php\nHeader unset Content-Security-Policy\n<Files \"goaindex.html\">\nAddDefaultCharset UTF-8\n</Files>\n";
1960+
$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user\nDirectoryIndex index.html index.php\nHeader set Content-Security-Policy \"default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;\"\n<Files \"goaindex.html\">\nAddDefaultCharset UTF-8\n</Files>\n";
19611961
$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
19621962
$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
19631963
unset($ht_file);

0 commit comments

Comments
 (0)