diff --git a/README.md b/README.md
index 63b9dc7..ec730fa 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ The _allow remote_ option is to allow remote add and stream of torrents.
* [x] Add RAR streaming support
* [ ] Better feedback in interface about streams
* [ ] Better feedback when using API
-* [ ] Reverse proxy improvement (e.g. port different than bind port)
+* [x] Reverse proxy improvement (e.g. port different than bind port)
# Version Info
@@ -55,6 +55,7 @@ The _allow remote_ option is to allow remote add and stream of torrents.
* Rewrote large parts of the code
* Now using [thomas](https://github.com/JohnDoee/thomas) as file-reading core - this adds support for multi-rar streaming.
* Faster streaming by reading directly from disk
+* Reverse proxy mode
## Version 0.9.0
* Few bugfixes
diff --git a/streaming/core.py b/streaming/core.py
index 3d1f958..afdeddf 100644
--- a/streaming/core.py
+++ b/streaming/core.py
@@ -81,6 +81,8 @@ DEFAULT_PREFS = {
'use_ssl': False,
'remote_username': 'stream',
'remote_password': ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(16)),
+ 'reverse_proxy_enabled': False,
+ 'reverse_proxy_base_url': '',
'serve_method': 'standalone',
'ssl_source': 'daemon',
'ssl_priv_key_path': '',
@@ -675,11 +677,16 @@ class Core(CorePluginBase):
else:
raise NotImplementedError()
- self.base_url += '://'
- if ':' in ip:
- self.base_url += ip
+ if self.config['reverse_proxy_enabled'] and self.config['reverse_proxy_base_url']:
+ self.base_url = self.config['reverse_proxy_base_url']
else:
- self.base_url += '%s:%s' % (ip, port)
+ self.base_url += '://'
+ if ':' in ip:
+ self.base_url += ip
+ else:
+ self.base_url += '%s:%s' % (ip, port)
+
+ self.base_url = self.base_url.rstrip('/')
@defer.inlineCallbacks
def disable(self):
diff --git a/streaming/data/config.glade b/streaming/data/config.glade
index 8960997..c2f8a20 100644
--- a/streaming/data/config.glade
+++ b/streaming/data/config.glade
@@ -166,6 +166,70 @@
1
+
+
+ True
+ False
+
+
+ Enable Reverse Proxy
+ True
+ True
+ False
+ False
+ True
+
+
+ False
+ False
+ 0
+
+
+
+
+ True
+ True
+ 2
+
+
+
+
+ True
+ False
+
+
+ True
+ False
+ Reverse Proxy Base Url:
+
+
+ False
+ False
+ 0
+
+
+
+
+ True
+ True
+ False
+ False
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ True
+ True
+ 3
+
+