From dca93a462af5749e2d3766bba0c403b1901a0323 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Wed, 18 Mar 2020 02:46:33 -0400 Subject: [PATCH] Created Reverse Proxy Setup (markdown) --- Reverse-Proxy-Setup.md | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Reverse-Proxy-Setup.md diff --git a/Reverse-Proxy-Setup.md b/Reverse-Proxy-Setup.md new file mode 100644 index 0000000..0011a6b --- /dev/null +++ b/Reverse-Proxy-Setup.md @@ -0,0 +1,62 @@ +# Reverse Proxy Setup + +## Introduction + +Using a reverse-proxy channels all YoutubeDL-Material requests through your web server, allowing you to easily enable SSL and take advantage of features like load-balancing. Explore the different approaches with your favorite web server. + +NOTE: These apache2 configurations are less tested than the nginx ones. If you encounter any errors, please open an issue [here](https://github.com/Tzahi12345/YoutubeDL-Material/issues). + +## Apache2 + +### On domain root + +Not much is required, just add these lines to your virtual host: + + ProxyPass / http://example.com:8998 + ProxyPassReverse / http://example.com:8998 + +And you'll be good to go! + +### Using domain subpath + +If you want to run YoutubeDL-Material in a subpath (e.g. `https://example.com/ytdl` instead of `https://example.com`), the configuration requires additional lines compared to instances on the document root. This is an example config where the desired path is `/ytdl` + + ProxyPass /ytdl http://example.com:8998 + ProxyPassReverse /ytdl http://example.com:8998 + ProxyPass /api/ http://example.com:8998 + ProxyPassReverse /api/ http://example.com:8998 + + + RewriteRule /ytdl/(.*) /$1 + + + RewriteRule ^/api/(.*) http://example.com:8998/api/$1 [P,QSA] + +Note the additional ProxyPass through /api/ and rewrite rules to ensure the app's requests get sent to the right place. + +## Nginx + +### On domain root + +This one's pretty simple, your reverse proxy configuration just needs to look like this: + + location / { + proxy_pass http://example.com:8998; + } + +And you should be good to go! + +### Using domain subpath + +If you want to run YoutubeDL-Material in a subpath (e.g. `https://example.com/ytdl` instead of `https://example.com`), the configuration requires additional lines compared to instances on the document root. This is an example config where the desired path is `/ytdl` + + location ~/ytdl(.*)$ { + rewrite /ytdl/(.*) / break; + proxy_pass http://example.com:8998; + } + + location /api/ { + proxy_pass http://example.com:8998; + } + +Note the additional rewrite rule and the required proxying of API calls in the `/api` route. \ No newline at end of file