Repository: pymedusa/Medusa

Issue:
Reverse proxy setup "HTTP Web root" not saving.
**Describe the bug**
I'm trying to set up a reverse proxy towards Medusa (domain, path based), which sort of works fine on the proxy end but I can't seem to save the setting called "HTTP Web root". Tried multiple times to enter this field and save it and however it gives a successful message, when I reload the page the input field is empty.

Reason I think I need this field is if I try to access the Medusa interace over my reverse proxy, lets say: example.com/medusa it redirects towards example.com/login/?next=%2Fmedusa . This should redirect towards example.com/medusa/login/

**To Reproduce**
Steps to reproduce the behavior:
1. Go to General Configuration
2. Click on Interface
3. Scroll down to HTTP Web root
4. Fill the field
5. Save.
6. Reload
7. Tada, empty field

**Expected behavior**
I expect this field to be stored successfully, which would than solve my issue with my reverse proxy. 

**Screenshots**

<img width="726" alt="image" src="https://user-images.githubusercontent.com/2735602/76450200-ae2f4380-63cd-11ea-8c49-965c8c5ba759.png">


**Medusa (please complete the following information):**
 - OS: Linux-3.10.105-armv7l-with-glibc2.4 // DSM 6.2.2-24922 Update 4
 - Branch: master
 - Commit: ee1b898d0f74750c4c265d077fcc0da73d17b41e
 - Python version: 2.7.14 
 - Database version: 44.14

**Additional context**

I don't have any logs for this, turned on debug logging but couldn't get the interface to show me the debug logs. If there is another location I can find these (via ssh/command line) I'd be glad to try.

Thanks in advance.


Discussion:

Resolving patch:
diff --git a/medusa/server/api/v2/config.py b/medusa/server/api/v2/config.py
--- a/medusa/server/api/v2/config.py
+++ b/medusa/server/api/v2/config.py
@@ -127,6 +127,7 @@ class ConfigHandler(BaseRequestHandler):
         'webInterface.httpsKey': StringField(app, 'HTTPS_KEY'),
         'webInterface.handleReverseProxy': BooleanField(app, 'HANDLE_REVERSE_PROXY'),
 
+        'webRoot': StringField(app, 'WEB_ROOT'),
         'cpuPreset': StringField(app, 'CPU_PRESET'),
         'sslVerify': BooleanField(app, 'SSL_VERIFY'),
         'sslCaBundle': StringField(app, 'SSL_CA_BUNDLE'),
@@ -657,6 +658,7 @@ def data_main():
         section_data['webInterface']['httpsKey'] = app.HTTPS_KEY
         section_data['webInterface']['handleReverseProxy'] = bool(app.HANDLE_REVERSE_PROXY)
 
+        section_data['webRoot'] = app.WEB_ROOT
         section_data['cpuPreset'] = app.CPU_PRESET
         section_data['sslVerify'] = bool(app.SSL_VERIFY)
         section_data['sslCaBundle'] = app.SSL_CA_BUNDLE


Test patch:
diff --git a/tests/apiv2/test_config.py b/tests/apiv2/test_config.py
--- a/tests/apiv2/test_config.py
+++ b/tests/apiv2/test_config.py
@@ -115,6 +115,7 @@ def config_main(monkeypatch, app_config):
     section_data['webInterface']['httpsKey'] = app.HTTPS_KEY
     section_data['webInterface']['handleReverseProxy'] = bool(app.HANDLE_REVERSE_PROXY)
 
+    section_data['webRoot'] = app.WEB_ROOT
     section_data['cpuPreset'] = app.CPU_PRESET
     section_data['sslVerify'] = bool(app.SSL_VERIFY)
     section_data['sslCaBundle'] = app.SSL_CA_BUNDLE