# Apache Reverse Proxy for the WebUI

**URL:** https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941
**Category:** Howto
**Created:** [June 4, 2015, 1:35am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941 "2015-06-04T01:35:38Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![zukoo](https://forum.syncthing.net/user_avatar/forum.syncthing.net/zukoo/32/891_2.png) [@zukoo](https://forum.syncthing.net/u/zukoo)
#### Post date: [June 4, 2015, 1:35am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/1 "2015-06-04T01:35:38Z")

</div>

Hello,

Just sharing a little config pretty useful if you want the webui to share the same port as a web site already hosted with Apache:

```
RewriteRule ^/gui$ /gui/ [R]
ProxyPass /gui/ http://localhost:8080/
<Location /gui/>
  ProxyPassReverse http://localhost:8080/
  Order Allow,Deny
  Allow from All
</Location>

```

Add this to a \*.conf file in conf.d directory of apache and it will redirect all requests on your standard apache port at location **gui/** to a syncthing WebUI hosted at **localhost:8080**.

This is also useful if you want to reuse your apache configuration such as SSL certificates or authentication.

---

<div class="post-metadata">

### Author: ![Alex](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@Alex](https://forum.syncthing.net/u/Alex)
#### Post date: [June 4, 2015, 7:38am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/2 "2015-06-04T07:38:31Z")

</div>

Another possibility to get the same is a .htaccess file in a folder of your webroot (for example gui to get the same like in your example)

```
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule ^(.*) http://localhost:8080/$1 [P]

```

this also redirects to https to prevent opening the gui unencrypted over the web. I use this method because I can’t change the config of apache on my shared hosting provider 😃

Maybe those methods should be added to the docs that people can easily find that?

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [June 4, 2015, 8:02am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/3 "2015-06-04T08:02:30Z")

</div>

It would be awesome if you guys could add these to the documentation repo.

---

<div class="post-metadata">

### Author: ![zukoo](https://forum.syncthing.net/user_avatar/forum.syncthing.net/zukoo/32/891_2.png) [@zukoo](https://forum.syncthing.net/u/zukoo)
#### Post date: [June 4, 2015, 8:09am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/4 "2015-06-04T08:09:43Z")

</div>

I can do it.

---

<div class="post-metadata">

### Author: ![zukoo](https://forum.syncthing.net/user_avatar/forum.syncthing.net/zukoo/32/891_2.png) [@zukoo](https://forum.syncthing.net/u/zukoo)
#### Post date: [June 6, 2015, 2:25am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/5 "2015-06-06T02:25:49Z")

</div>

Pull request here: [https://github.com/syncthing/docs/pull/13](https://github.com/syncthing/docs/pull/13)

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [June 6, 2015, 7:39am UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/6 "2015-06-06T07:39:22Z")

</div>

Merged into [http://docs.syncthing.net/users/reverseproxy.html;](http://docs.syncthing.net/users/reverseproxy.html;) thanks.

---

<div class="post-metadata">

### Author: ![letroll](https://forum.syncthing.net/user_avatar/forum.syncthing.net/letroll/32/3311_2.png) [@letroll](https://forum.syncthing.net/u/letroll)
#### Post date: [January 14, 2017, 4:37pm UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/7 "2017-01-14T16:37:02Z")

</div>

I use configuration from [https://docs.syncthing.net/users/reverseproxy.html#folder-configuration](https://docs.syncthing.net/users/reverseproxy.html#folder-configuration) on my nginx server. But when I run myadresse . com/syncthing/ my website reload this url : myadresse . com can you help me?

---

<div class="post-metadata">

### Author: ![JKing](https://forum.syncthing.net/user_avatar/forum.syncthing.net/jking/32/2876_2.png) [@JKing](https://forum.syncthing.net/u/JKing)
#### Post date: [January 14, 2017, 5:21pm UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/8 "2017-01-14T17:21:36Z")

</div>

Could you post your configuration for the relevant virtual host? I expect there’s another location block taking precedence.

---

<div class="post-metadata">

### Author: ![letroll](https://forum.syncthing.net/user_avatar/forum.syncthing.net/letroll/32/3311_2.png) [@letroll](https://forum.syncthing.net/u/letroll)
#### Post date: [January 15, 2017, 5:12pm UTC](https://forum.syncthing.net/t/apache-reverse-proxy-for-the-webui/2941/9 "2017-01-15T17:12:14Z")

</div>

it’s here:

```
    server {
    listen 80;
    listen 443 ssl;
    server_name myurl.fr;
    ssl_certificate /etc/letsencrypt/...../...pem;
    ssl_certificate_key /etc/letsencrypt/...../....pem;

    access_log /var/log/nginx/myurl.log;
    error_log /var/log/nginx/myurl.log;

    location / {
	    proxy_pass ...:2369;
	    proxy_connect_timeout 90;
	    proxy_send_timeout 90;
	    proxy_read_timeout 60;
	    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	    proxy_set_header Host $http_host;
	    proxy_set_header X-Forwarded-Proto $scheme;
    }

    location ~ /.well-known {
        allow all;
    }

    location /transmission {
        proxy_pass ...:9090;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;

        # include Host header
        proxy_set_header Host $http_host;
    }

  location /sickrage {
    proxy_pass ....:8081;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

   location /couch {
    proxy_pass ....:5050;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

   location /headphone {
    proxy_pass ......:8181;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

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;

proxy_pass http://localhost:8384/;
}

location /emby {
    proxy_pass ....:8096;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}

```
