From 9c8d7d6260c01b8e9fd833bf79898edf5c367200 Mon Sep 17 00:00:00 2001 From: Nicholas Thompson Date: Sat, 9 Mar 2019 15:57:17 +0200 Subject: [PATCH] Added Nginx proxy setup example to readme --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 9a2deee..304ef35 100644 --- a/README.md +++ b/README.md @@ -257,3 +257,50 @@ Example ``` -dev=/dev/ttyUSB0 ``` + +## Nginx Proxy + +The following configuration works for Nginx to allow the `invertergui` to be proxied: + +When using a stand HTTP or HTTPS port to expose the gui: + +``` + location /invertergui { + return 302 /invertergui/; + } + + location /invertergui/ { + proxy_pass http://localhost:8080/; + proxy_set_header Host $host; + } + + location /invertergui/ws { + proxy_pass http://localhost:8080/ws; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; + proxy_set_header Host $host; + + proxy_set_header Referer $http_referer; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + } +``` + +When using a non-stand HTTP or HTTPS port to expose the gui change the HTTP Host description: + +``` + proxy_set_header Host $host:$server_port; +``` + +The last four lines are optional, but is useful when debugging and logging connections: + +``` + proxy_set_header Referer $http_referer; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; +```