From b597ac097188fe9f0ee19318895899d320086346 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 26 May 2018 18:57:18 +0100 Subject: [PATCH] Add rewrites for json api --- src/freedombone-utils-web | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index 508ff7a6..8e0fc008 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -1163,6 +1163,19 @@ function install_web_local_user_interface { echo ''; echo ' access_log /dev/null;'; echo ' error_log /dev/null;'; + echo ''; + echo ' location /icons {'; + echo ' autoindex on;'; + echo ' break;'; + echo ' }'; + echo ''; + echo ' rewrite ^/plinth/(.*)$ /api.json last;'; + echo ''; + echo ' location / {'; + echo " root /var/www/${local_hostname}/htdocs/plinth;"; + echo ' index api.json /api.json;'; + echo " error_page 405 = \$uri;"; + echo ' }'; echo '}'; echo ''; echo 'server {'; @@ -1180,6 +1193,19 @@ function install_web_local_user_interface { nginx_security_options "${local_hostname}" { echo ' add_header Strict-Transport-Security max-age=0;'; + echo ''; + echo ' location /icons {'; + echo ' autoindex on;'; + echo ' break;'; + echo ' }'; + echo ''; + echo ' rewrite ^/plinth/(.*)$ /api.json last;'; + echo ''; + echo ' location / {'; + echo " root /var/www/${local_hostname}/htdocs/plinth;"; + echo ' index api.json /api.json;'; + echo " error_page 405 = \$uri;"; + echo ' }'; echo '}'; } >> "$nginx_file" if [ ! -f "/etc/ssl/certs/${local_hostname}.crt" ]; then