Description:This script is used to create a reverse proxy frontend entry with websocket support. List of used variables:Variable | Description |
---|
connection | (Optional) A WAN connection can be specified here. If one is specified, it must be referenced as shown in the example. | backend | (mandatory) The name of the desired and previously created backend entry must be referenced here. | websocket | (Optional) Websocket support. Can be activated with true and deactivated with false . | certificateUid | If ssl is set to true and letsEncrypt isNOT set, a reference to the commonName of the stored certificate must be specified here. If SSL is not used or Let's Encrypt is used, the field can be left empty with “”. | keyPassword | If a certificate is referenced, the corresponding private key for validation must be entered here. |
If Let's Encrypt is used, the certificateUid field must be left empty and letsEncrypt must be set to true . |
Add-in code:/** * @param {Config} config * @param {Context} context * Do not edit this comment or parameter types. Required for code suggestions */ exports.main = function (config, context) { const ufApi = config.getUfApi(); var fwVersion = context.device.firmwareVersionObject; if (fwVersion.patch >= 7304) // LCOS FX 10.13 REL { ufApi.createObject( 'reverse-proxy-frontends', { "domain": "dasisteintest.de", "active": true, "connection": ufApi.lookupField("connections", "uniqueId", {"name": "WAN"}), // WAN-connection as a filter, if whished "proxiedPaths": [ { "backend": ufApi.lookupField("reverse-proxy-backends", "uniqueId", {"name": "Testserver"}), // Name of the backend server entry "url": "/", "websocket":true } ], "blockedPaths": [], "port": 443, "ssl": true, "letsEncrypt": false, "certificateUid": ufApi.lookupField("certificates", "uniqueId", {"commonName": "FrontendCert"}), // commonName of the used certificate "outlook": false, "backendType": "custom", "httpRedirect": false, "keyPassword":"MyCertPassword" } ); } else { config.infoLog("Cannot set Reverse-Proxy-Frontend entry. Websockets via REST-API is supported since LCOS FX 10.13 REL") } }; |
---|
Add-in as JSON file:
|