From bc16a91f540a9408116b7ca22123f608558d14ac Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 Jan 2021 11:02:12 +0100 Subject: [PATCH 1/6] Fix --- conf/nginx.conf | 13 ++++++++++++- scripts/install | 2 ++ sources/index.html | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 052c370..faab01b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,13 +2,24 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; + + index index.html; # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + location ~ ^__PATH__/http-bind/ { + proxy_pass http://__DOMAIN__; + } + + location ~ .(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ { + add_header Access-Control-Allow-Origin "*"; # Decide here whether you want to allow all or only a particular domain + root __FINALPATH__/; # Properly set the path here + } + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/scripts/install b/scripts/install index c07c8a5..7f93c07 100755 --- a/scripts/install +++ b/scripts/install @@ -59,6 +59,8 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, the source from sources folder mkdir -p $final_path && cp -a ../sources/* $final_path +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/index.html" + #================================================= # NGINX CONFIGURATION #================================================= diff --git a/sources/index.html b/sources/index.html index 37c965c..1cd4f00 100644 --- a/sources/index.html +++ b/sources/index.html @@ -49,7 +49,7 @@ authentication: 'login', auto_away: 300, auto_reconnect: true, - bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes + bosh_service_url: 'https://__DOMAIN__/http-bind/', message_archiving: 'always', view_mode: 'fullscreen' }); From fde03cdc57eb1c68d883c3fb2ee0dbd9fb8e5b5f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 Jan 2021 12:45:18 +0100 Subject: [PATCH 2/6] Fix --- conf/nginx.conf | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index faab01b..a1415db 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -11,14 +11,16 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - location ~ ^__PATH__/http-bind/ { - proxy_pass http://__DOMAIN__; - } - - location ~ .(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ { - add_header Access-Control-Allow-Origin "*"; # Decide here whether you want to allow all or only a particular domain - root __FINALPATH__/; # Properly set the path here - } + location __PATH__/http-bind { + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + proxy_pass http://127.0.0.1:5290/http-bind; + proxy_set_header Host $host; + proxy_buffering off; + tcp_nodelay on; + access_log off; + } # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; From bf3aa84decba6e7c4714e4bb38979c59cd591c2c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 Jan 2021 13:46:56 +0100 Subject: [PATCH 3/6] Fix --- conf/nginx.conf | 40 +++++++++++++++++++++------------------- scripts/install | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a1415db..7d452ba 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,27 +1,29 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/; + # Path to source + alias __FINALPATH__/; - index index.html; + index index.html; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + # Force usage of https + f ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } - location __PATH__/http-bind { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_pass http://127.0.0.1:5290/http-bind; - proxy_set_header Host $host; - proxy_buffering off; - tcp_nodelay on; - access_log off; - } + location = __PATH__/http-bind { + proxy_pass http://localhost:5290/http-bind; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Forwarded-Port $server_port; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection “upgrade”; + } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/scripts/install b/scripts/install index 7f93c07..c218935 100755 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, the source from sources folder mkdir -p $final_path && cp -a ../sources/* $final_path -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/index.html" +ynh_replace_string --match_string="__DOMAIN____PATH__" --replace_string="$domain$path_url" --target_file="$final_path/index.html" #================================================= # NGINX CONFIGURATION From 1b94a55f30f15ad8dd5b58e3c0746823f61216d6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 Jan 2021 13:54:15 +0100 Subject: [PATCH 4/6] Update nginx.conf --- conf/nginx.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 7d452ba..a06ccc7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -11,6 +11,10 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +} + location = __PATH__/http-bind { proxy_pass http://localhost:5290/http-bind; proxy_redirect off; @@ -23,7 +27,3 @@ location __PATH__/ { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; } - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; -} From f64ad6416897daad7ed95d90044ae2e55a1c258a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 Jan 2021 13:56:10 +0100 Subject: [PATCH 5/6] Update nginx.conf --- conf/nginx.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a06ccc7..e14d71f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,14 +7,10 @@ location __PATH__/ { index index.html; # Force usage of https - f ($scheme = http) { + if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; -} - location = __PATH__/http-bind { proxy_pass http://localhost:5290/http-bind; proxy_redirect off; @@ -27,3 +23,7 @@ location __PATH__/ { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +} From 2972e2f79b855721448f564aff0ae667c1a2706d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 30 Jan 2021 13:58:07 +0100 Subject: [PATCH 6/6] Update index.html --- sources/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/index.html b/sources/index.html index 1cd4f00..742ee94 100644 --- a/sources/index.html +++ b/sources/index.html @@ -49,7 +49,7 @@ authentication: 'login', auto_away: 300, auto_reconnect: true, - bosh_service_url: 'https://__DOMAIN__/http-bind/', + bosh_service_url: 'https://__DOMAIN____PATH__/http-bind', message_archiving: 'always', view_mode: 'fullscreen' });