Jump to content

WebGUI over Reverse Proxy: Invalid URL for encryptedRequest


Recommended Posts

Posted

The DCS WebGUI app communicates with the DCS dedicated server via HTTP POST requests to /encryptedRequest. On the dedicated server, these POST requests are handled by a built-in HTTP server listening on :8088 (or whatever port configured via webgui_port in autoexec.cfg). This works well when accessing the WebGUI in a browser to communicate with a local dedicated server.

Unfortunately, the URL is hard-coded into WebGUI/js/app.js as http://127.0.0.1:8088/encryptedRequest, which fails when providing access to the WebGUI via an HTTP reverse proxy. Supporting reverse proxy use would facilitate providing configurable, secure access to the WebGUI on dedicated servers without handing out the server account login credentials. This has come up in the forums a couple of times [1, 2, 3, 4].

Screenshot of the WebGUI issue with and unmodified WebGUI/js/app.js file:

WebGUI_Reverse_Proxy.JPG

This issue is relatively straightforward to fix by removing the hard-coded URL from WebGUI/js/app.js and setting up the encryption key for non-local use with the following three search and replace operations:

Search: dynamicUrl:"http://127.0.0.1\\:8088/encryptedRequest"
Replace: dynamicUrl:"encryptedRequest"

Search: "http://".concat(e.address,":").concat(e.port,"/encryptedRequest")
Replace: window.location.protocol=="file:"?"http://".concat(e.address,":").concat(e.port,"/encryptedRequest"):"encryptedRequest"

Search: if(e.url.includes("file:///")||e.url.includes("localhost"))
Replace: if(true)

Or alternatively via a single sed invocation:

sed 's,dynamicUrl:"http://127.0.0.1\\\\:8088/encryptedRequest",dynamicUrl:"encryptedRequest",' app.js.orig \
| sed 's,if(e.url.includes("file:///")||e.url.includes("localhost")),if(true),' \
| sed 's;"http://".concat(e.address,":").concat(e.port,"/encryptedRequest");window.location.protocol==="file:"?"http://".concat(e.address,":").concat(e.port,"/encryptedRequest"):"encryptedRequest";' >app.js.fixed

 

These minimal changes will enable use of the WebGUI via a reverse proxy, without affecting local WebGUI use (will work as before).

WebGUI_Reverse_Proxy_Fixed.JPG

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...