diff --git a/conf/config.js b/conf/config.js index ffd8e2c..7997333 100644 --- a/conf/config.js +++ b/conf/config.js @@ -32,7 +32,7 @@ module.exports = { * it is recommended that you configure these fields to match the * domain which will serve your cryptpad instance. */ - "connect-src 'self' ws://*", + "connect-src 'self' ws://__URL__cryptpad_websocket ws://*", "child-src 'self' *", // data: is used by codemirror diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ace275..4855df4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,7 +10,19 @@ location / { proxy_set_header Connection upgrade; } +location = /cryptpad_websocket { + proxy_pass http://localhost:__PORT__; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # WebSocket support (nginx 1.4) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; +} + + #location = /api/config { # default_type text/javascript; # rewrite ^.*$ /customize/api/config break; diff --git a/scripts/install b/scripts/install index 6f46d34..3efa94b 100644 --- a/scripts/install +++ b/scripts/install @@ -99,8 +99,7 @@ ynh_use_logrotate final_path=/var/www/$app ynh_app_setting_set $app final_path $final_path -#ynh_setup_source $final_path -sudo git clone https://github.com/xwiki-labs/cryptpad.git $final_path +ynh_setup_source $final_path #================================================= # Files owned by root, www-data can just read @@ -140,8 +139,8 @@ popd #================================================= sudo mv ../conf/config.js $final_path/config.js -ynh_replace_string "__URL__" "$path_url" "$final_path/config.js" ynh_replace_string "__PORT__" "$port" "$final_path/config.js" +ynh_replace_string "__URL__" "$domain$path_url" "$final_path/config.js" #================================================= # INSTALL MODULES FOR CRYPTPAD