Files
syncthing/users/reverseproxy.rst
T

72 lines
1.9 KiB
ReStructuredText
Raw Normal View History

2015-06-06 10:24:01 +08:00
.. _reverse-proxy-setup:
Reverse Proxy Setup
===================
2015-06-06 07:15:33 +02:00
A reverse proxy allow you to "pass" requests through your web server to another
site or program. The reverse proxy will make it look like Syncthing's GUI is a
page within your existing site.
2015-06-06 10:24:01 +08:00
This is especially useful if:
- You need to access the GUI on port 80 or 443 but you already host a website
on the same device.
- You want to share SSL certificates with an existing site.
- You want to share authentification with an existing setup.
2015-06-06 10:24:01 +08:00
Server Configuration
--------------------
If you have access to your web server's configuration use the following
examples to pass the location ``/syncthing`` on your web server to Syncthing's
GUI hosted on ``localhost:8384``.
2015-06-06 10:24:01 +08:00
Apache
~~~~~~
.. code-block:: apache
2015-06-06 10:24:01 +08:00
ProxyPass /syncthing/ http://localhost:8384/
<Location /syncthing/>
ProxyPassReverse http://localhost:8384/
Require all granted
2015-06-06 10:24:01 +08:00
</Location>
Nginx
~~~~~
.. code-block:: nginx
2015-06-06 10:24:01 +08:00
location /syncthing/ {
proxy_set_header Host $host;
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 $scheme;
2015-06-06 10:24:01 +08:00
proxy_pass http://localhost:8384/;
}
Folder Configuration
--------------------
If you don't have access to your web server configuration files you might try
the following technique.
Apache
~~~~~~
Add the configuration below to a ``.htaccess`` file in the folder of your
webroot which should redirect to the WebUI, ``/syncthing`` to produce the same
2015-06-06 10:24:01 +08:00
behaviour as above
.. code-block:: apache
2015-06-06 10:24:01 +08:00
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
2015-06-06 12:01:47 +02:00
RewriteRule ^(.*) http://localhost:8384/$1 [P]
2015-06-06 10:24:01 +08:00
2015-06-06 07:15:33 +02:00
This method also redirects to HTTPS to prevent opening the GUI unencrypted.