mirror of
https://github.com/YunoHost-Apps/cryptpad_ynh.git
synced 2024-09-03 18:26:14 +02:00
[NoFix] Conf Nginx
This commit is contained in:
parent
b2d17109d7
commit
11705f24ca
1 changed files with 34 additions and 43 deletions
|
@ -1,54 +1,45 @@
|
||||||
root ROOT_PATH;
|
root ROOT_PATH;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
if ($args ~ ver=) {
|
location / {
|
||||||
set $cacheControl max-age=31536000;
|
proxy_pass http://localhost:3000/;
|
||||||
}
|
add_header X-Frame-Options SAMEORIGIN;
|
||||||
# Will not set any header if it is emptystring
|
proxy_set_header Host $host;
|
||||||
add_header Cache-Control $cacheControl;
|
|
||||||
|
|
||||||
set $styleSrc "'unsafe-inline' 'self'";
|
|
||||||
set $scriptSrc "'self'";
|
|
||||||
set $connectSrc "'self' wss://cryptpad.fr wss://api.cryptpad.fr";
|
|
||||||
set $fontSrc "'self'";
|
|
||||||
set $imgSrc "data: *";
|
|
||||||
set $frameSrc "'self' beta.cryptpad.fr";
|
|
||||||
|
|
||||||
if ($uri = /pad/inner.html) {
|
|
||||||
set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline'";
|
|
||||||
}
|
|
||||||
add_header Content-Security-Policy "default-src 'none'; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc;";
|
|
||||||
|
|
||||||
location = /cryptpad_websocket {
|
|
||||||
proxy_pass http://localhost:3000;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
|
|
||||||
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
||||||
# WebSocket support (nginx 1.4)
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection upgrade;
|
proxy_set_header Connection upgrade;
|
||||||
}
|
|
||||||
|
|
||||||
location ^~ /customize.dist/ {
|
}
|
||||||
# This is needed in order to prevent infinite recursion between /customize/ and the root
|
|
||||||
}
|
location = /api/config {
|
||||||
location ^~ /customize/ {
|
|
||||||
rewrite ^/customize/(.*)$ $1 break;
|
|
||||||
try_files /customize/$uri /customize.dist/$uri;
|
|
||||||
}
|
|
||||||
location = /api/config {
|
|
||||||
default_type text/javascript;
|
default_type text/javascript;
|
||||||
rewrite ^.*$ /customize/api/config break;
|
rewrite ^.*$ /customize/api/config break;
|
||||||
}
|
}
|
||||||
|
|
||||||
## TODO fix in the code so that we don't need this
|
if ($uri = /pad/inner.html) {
|
||||||
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard)$ {
|
set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline'";
|
||||||
rewrite ^(.*)$ $1/ redirect;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try_files /www/$uri /www/$uri/index.html /customize/$uri;
|
|
||||||
# Include SSOWAT user panel.
|
location = /cryptpad_websocket {
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
proxy_pass http://localhost:3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^~ /customize.dist/ {
|
||||||
|
# This is needed in order to prevent infinite recursion between /customize/ and the root
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^~ /customize/ {
|
||||||
|
rewrite ^/customize/(.*)$ $1 break;
|
||||||
|
try_files /customize/$uri /customize.dist/$uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## TODO fix in the code so that we don't need this
|
||||||
|
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard)$ {
|
||||||
|
rewrite ^(.*)$ $1/ redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
try_files /www/$uri /www/$uri/index.html /customize/$uri;
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue