From 81568c342223d4f8bc0ebfb67d8e1f86372f599c Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:36:38 +0200 Subject: [PATCH 1/7] Add set up steps including nginx example --- docs/how_to_setup_reverse_proxy | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/how_to_setup_reverse_proxy diff --git a/docs/how_to_setup_reverse_proxy b/docs/how_to_setup_reverse_proxy new file mode 100644 index 00000000..6b31493b --- /dev/null +++ b/docs/how_to_setup_reverse_proxy @@ -0,0 +1,34 @@ +## Setting up reverse proxy +To make Darawich work with a reverse proxy, you need to ensure the APPLICATION_HOST environment variable is set to the domain name that the reverse proxy will use. +For example, if your Darawich instance is supposed to be on the domain name timeline.mydomain.com, then set the environment variable to "timeline.mydomain.com". +Make sure to exclude "http://" or "https://" from the environment variable. The webpage will not work if you do include http:// or https:// in the variable. + +At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOST entries in the docker-compose.yml file and change them from "localhost" to your domain name. +For a synology install, refer to **[Synology Install Tutorial](docs/How_to_install_Dawarich_on_Synology.md)**. In this page it is explained how to set the APPLICATION_HOST environment variable. + +Now that the app works with a domain name, the server needs to be setup to use a reverse proxy. Usually this is done by setting it up in the virtual host configuration. + +Below are examples of reverse proxy configurations. + +### Nginx +``` +server { + + listen 80; + listen [::]:80; + server_name example.com; + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header Host $http_host; + proxy_redirect off; + + proxy_pass http://127.0.0.1:3000/; + } + +} + +``` From 5e90e1570dfad79c4c4ae5418fc89a5172290bf9 Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:37:01 +0200 Subject: [PATCH 2/7] Rename how_to_setup_reverse_proxy to how_to_setup_reverse_proxy.md --- .../{how_to_setup_reverse_proxy => how_to_setup_reverse_proxy.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{how_to_setup_reverse_proxy => how_to_setup_reverse_proxy.md} (100%) diff --git a/docs/how_to_setup_reverse_proxy b/docs/how_to_setup_reverse_proxy.md similarity index 100% rename from docs/how_to_setup_reverse_proxy rename to docs/how_to_setup_reverse_proxy.md From 4c54a0181a3de8caa25be176af269332c2ab66e1 Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:38:02 +0200 Subject: [PATCH 3/7] Add headers --- docs/how_to_setup_reverse_proxy.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/how_to_setup_reverse_proxy.md b/docs/how_to_setup_reverse_proxy.md index 6b31493b..90a7904e 100644 --- a/docs/how_to_setup_reverse_proxy.md +++ b/docs/how_to_setup_reverse_proxy.md @@ -1,4 +1,6 @@ ## Setting up reverse proxy + +### Environment Variable To make Darawich work with a reverse proxy, you need to ensure the APPLICATION_HOST environment variable is set to the domain name that the reverse proxy will use. For example, if your Darawich instance is supposed to be on the domain name timeline.mydomain.com, then set the environment variable to "timeline.mydomain.com". Make sure to exclude "http://" or "https://" from the environment variable. The webpage will not work if you do include http:// or https:// in the variable. @@ -6,6 +8,8 @@ Make sure to exclude "http://" or "https://" from the environment variable. The At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOST entries in the docker-compose.yml file and change them from "localhost" to your domain name. For a synology install, refer to **[Synology Install Tutorial](docs/How_to_install_Dawarich_on_Synology.md)**. In this page it is explained how to set the APPLICATION_HOST environment variable. +### Virtual Host + Now that the app works with a domain name, the server needs to be setup to use a reverse proxy. Usually this is done by setting it up in the virtual host configuration. Below are examples of reverse proxy configurations. From 6eb27674b2a5bb71d0a0528ccfca4e19c57ebb6e Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:40:38 +0200 Subject: [PATCH 4/7] Fix path to synology tutorial docs --- docs/how_to_setup_reverse_proxy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to_setup_reverse_proxy.md b/docs/how_to_setup_reverse_proxy.md index 90a7904e..dff5f732 100644 --- a/docs/how_to_setup_reverse_proxy.md +++ b/docs/how_to_setup_reverse_proxy.md @@ -6,7 +6,7 @@ For example, if your Darawich instance is supposed to be on the domain name time Make sure to exclude "http://" or "https://" from the environment variable. The webpage will not work if you do include http:// or https:// in the variable. At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOST entries in the docker-compose.yml file and change them from "localhost" to your domain name. -For a synology install, refer to **[Synology Install Tutorial](docs/How_to_install_Dawarich_on_Synology.md)**. In this page it is explained how to set the APPLICATION_HOST environment variable. +For a synology install, refer to **[Synology Install Tutorial](How_to_install_Dawarich_on_Synology.md)**. In this page it is explained how to set the APPLICATION_HOST environment variable. ### Virtual Host From e2cdfdcbd3f67125d72f8993acb25e71e76c50ff Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:28:56 +0200 Subject: [PATCH 5/7] Add Apache2 instructions --- docs/how_to_setup_reverse_proxy.md | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/how_to_setup_reverse_proxy.md b/docs/how_to_setup_reverse_proxy.md index dff5f732..02b65595 100644 --- a/docs/how_to_setup_reverse_proxy.md +++ b/docs/how_to_setup_reverse_proxy.md @@ -36,3 +36,40 @@ server { } ``` + +### Apache2 + +For Apache2, you might need to enable some modules. Start by entering the following commands so the example configuration below works without any problems. + +``` +sudo a2enmod proxy +sudo a2enmod proxy_http +sudo a2enmod headers +``` + +With the above commands entered, the configuration below should work properly. + +``` + + ServerName example.com + + ProxyRequests Off + ProxyPreserveHost On + + + Require all granted + + + Header always set X-Real-IP %{REMOTE_ADDR}s + Header always set X-Forwarded-For %{REMOTE_ADDR}s + Header always set X-Forwarded-Proto https + Header always set X-Forwarded-Server %{SERVER_NAME}s + Header always set Host %{HTTP_HOST}s + + ProxyPass / http://127.0.0.1:3000/ + ProxyPassReverse / http://127.0.0.1:3000/ + + +``` + +Please note that the above configurations are just examples and that they contain the minimum configuration needed to make the reverse proxy work properly. Feel free to adjust the configuration to your own needs. From ed67f94f8dff7d8520f74257847012d06ee45eb6 Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:30:15 +0200 Subject: [PATCH 6/7] Add reverse proxy guide to main page --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e50bf806..d344b0c0 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ To import your Google Maps Timeline data, download your location history from [G ## How-to's +- [How to set up reverse proxy](docs/how_to_setup_reverse_proxy.md) - [How to import Google Takeout to Dawarich](https://github.com/Freika/dawarich/wiki/How-to-import-your-Google-Takeout-data) - [How to Import Google Semantic History to Dawarich](https://github.com/Freika/dawarich/wiki/How-to-import-your-Google-Semantic-History-data) - [How to track your location to Dawarich with Overland](https://github.com/Freika/dawarich/wiki/How-to-track-your-location-to-Dawarich-with-Overland) From b6040f233d3ce66ba855196bb5e6cf3e7257a31f Mon Sep 17 00:00:00 2001 From: sunstep <73174517+sunstep@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:39:01 +0200 Subject: [PATCH 7/7] Fix Dawarich typo --- docs/how_to_setup_reverse_proxy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how_to_setup_reverse_proxy.md b/docs/how_to_setup_reverse_proxy.md index 02b65595..e1260f59 100644 --- a/docs/how_to_setup_reverse_proxy.md +++ b/docs/how_to_setup_reverse_proxy.md @@ -1,8 +1,8 @@ ## Setting up reverse proxy ### Environment Variable -To make Darawich work with a reverse proxy, you need to ensure the APPLICATION_HOST environment variable is set to the domain name that the reverse proxy will use. -For example, if your Darawich instance is supposed to be on the domain name timeline.mydomain.com, then set the environment variable to "timeline.mydomain.com". +To make Dawarich work with a reverse proxy, you need to ensure the APPLICATION_HOST environment variable is set to the domain name that the reverse proxy will use. +For example, if your Dawarich instance is supposed to be on the domain name timeline.mydomain.com, then set the environment variable to "timeline.mydomain.com". Make sure to exclude "http://" or "https://" from the environment variable. The webpage will not work if you do include http:// or https:// in the variable. At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOST entries in the docker-compose.yml file and change them from "localhost" to your domain name.