diff --git a/docs/management.md b/docs/management.md index f2e83b55..fc8336e2 100644 --- a/docs/management.md +++ b/docs/management.md @@ -619,6 +619,8 @@ Note, that if you choose not to use `server.js` to serve up the app, you will lo Example Configs - [NGINX](#nginx) - [Apache](#apache) +- [Caddy](#caddy) +- [Firebase](#firebase-hosting) - [cPanel](#cpanel) ### NGINX @@ -640,6 +642,9 @@ server { } } ``` + +To use HTML5 history mode (`appConfig.routingMode: history`), replace the inside of the location block with: `try_files $uri $uri/ /index.html;`. + Then upload the build contents of Dashy's dist directory to that location. For example: `scp -r ./dist/* [username]@[server_ip]:/var/www/dashy/html` @@ -654,6 +659,15 @@ In your Apache config, `/etc/apche2/apache2.conf` add: AllowOverride All Require all granted + + + RewriteEngine On + RewriteBase / + RewriteRule ^index\.html$ - [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.html [L] + ``` Add a `.htaccess` file within `/var/www/html/dashy/.htaccess`, and add: @@ -666,6 +680,39 @@ RewriteRule ^ index.html [QSA,L] Then restart Apache, with `sudo systemctl restart apache2` +### Caddy + +Caddy v2 +``` +try_files {path} / +``` + +Caddy v1 +``` +rewrite { + regexp .* + to {path} / +} +``` + +### Firebase Hosting + +Create a file names `firebase.json`, and populate it with something similar to: + +``` +{ + "hosting": { + "public": "dist", + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} +``` + ### cPanel 1. Login to your WHM 2. Open 'Feature Manager' on the left sidebar diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 70c52539..da43493a 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -35,6 +35,16 @@ Header set X-Frame-Options: "ALLOW-FROM http://[dashy-location]/" --- +## 404 On Static Hosting + +If you're seeing Dashy's 404 page on initial load/ refresh, and then the main app when you go back to Home, then this is likely caused by the Vue router, and if so can be fixed in one of two ways. + +The first solution is to switch the routing mode, from HTML5 `history` mode to `hash` mode, by setting `appConfig.routingMode` to `hash`. + +If this works, but you wish to continue using HTML5 history mode, then a bit of extra [server configuration](/docs/management.md#web-server-configuration) is required. This is explained in more detaail in the [Vue Docs](https://router.vuejs.org/guide/essentials/history-mode.html). Once completed, you can then use `routingMode: history` again, for neater URLs. + +--- + ## Yarn Error For more info, see [Issue #1](https://github.com/Lissy93/dashy/issues/1) @@ -180,4 +190,4 @@ Currently, the status check needs a page to be rendered, so if this URL in your For further troubleshooting, use an application like [Postman](https://postman.com) to diagnose the issue. Set the parameter to `GET`, and then make a call to: `https://[url-of-dashy]/status-check/?&url=[service-url]`. Where the service URL must have first been encoded (e.g. with `encodeURIComponent()` or [urlencoder.io](https://www.urlencoder.io/)) -If you're serving Dashy though a CDN, instead of using the Node server or Docker image, then the Node endpoint that makes requests will not be available to you, and all requests will fail. A workaround for this may be implemented in the future, but in the meantime, your only option is to use the Docker or Node deployment method. \ No newline at end of file +If you're serving Dashy though a CDN, instead of using the Node server or Docker image, then the Node endpoint that makes requests will not be available to you, and all requests will fail. A workaround for this may be implemented in the future, but in the meantime, your only option is to use the Docker or Node deployment method.