Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tommaso Perondi
ISPConfig 3
Commits
6eede43c
Commit
6eede43c
authored
Oct 15, 2020
by
Till Brehm
Browse files
Resolve "GoAccess stats blocked by Content Security Policy (nginx)"
parent
d9410296
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/conf/nginx_vhost.conf.master
View file @
6eede43c
...
...
@@ -169,7 +169,7 @@ server {
index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file <tmpl_var name='stats_auth_passwd_file'>;
add_header Content-Security-Policy "default-src * 'self' 'unsafe-inline';";
add_header Content-Security-Policy "default-src * 'self' 'unsafe-inline'
'unsafe-eval' data:
;";
}
location ^~ /awstats-icon {
...
...
server/plugins-available/apache2_plugin.inc.php
View file @
6eede43c
...
...
@@ -1957,7 +1957,7 @@ class apache2_plugin {
if
(
$data
[
'new'
][
'stats_type'
]
!=
''
)
{
if
(
!
is_dir
(
$data
[
'new'
][
'document_root'
]
.
'/'
.
$web_folder
.
'/stats'
))
$app
->
system
->
mkdir
(
$data
[
'new'
][
'document_root'
]
.
'/'
.
$web_folder
.
'/stats'
);
$ht_file
=
"AuthType Basic
\n
AuthName
\"
Members Only
\"\n
AuthUserFile "
.
$data
[
'new'
][
'document_root'
]
.
"/web/stats/.htpasswd_stats
\n
require valid-user
\n
DirectoryIndex index.html index.php
\n
Header
un
set Content-Security-Policy
\n
<Files
\"
goaindex.html
\"
>
\n
AddDefaultCharset UTF-8
\n
</Files>
\n
"
;
$ht_file
=
"AuthType Basic
\n
AuthName
\"
Members Only
\"\n
AuthUserFile "
.
$data
[
'new'
][
'document_root'
]
.
"/web/stats/.htpasswd_stats
\n
require valid-user
\n
DirectoryIndex index.html index.php
\n
Header set Content-Security-Policy
\"
default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;
\"
\n
<Files
\"
goaindex.html
\"
>
\n
AddDefaultCharset UTF-8
\n
</Files>
\n
"
;
$app
->
system
->
file_put_contents
(
$data
[
'new'
][
'document_root'
]
.
'/'
.
$web_folder
.
'/stats/.htaccess'
,
$ht_file
);
$app
->
system
->
chmod
(
$data
[
'new'
][
'document_root'
]
.
'/'
.
$web_folder
.
'/stats/.htaccess'
,
0755
);
unset
(
$ht_file
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment