mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
www/caddy: Add HTTP keepalive to handler, revert NTLM deprecation. (#4072)
* www/caddy: Add HTTP Keepalive option. Needed so that HTTP Keepalive can be set 0 (off) combined with HTTP Version 1.1, in order to replace the deprecated NTLM option. * www/caddy: Change headers inside handler form for better sorting of options. * www/caddy: Add changelog. * www/caddy: Change tick timeout of CaddyCertificate widget to seconds. * www/caddy: Move NTLM back to standard options. Remove deprecation notice from changelog. Improve helptexts. * www/caddy: Remove try/catch block because this.ajaxGet() handles errors. In CaddyCertificate and CaddyDomain widgets.
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ Plugin Changelog
|
||||
* Add: forward_auth directive with Authelia as Authz Provider.
|
||||
* Add: Default HTTP and HTTPS ports can be changed in general settings.
|
||||
* Add: Introduce HTTP version to handler. HTTP/1.1, HTTP/2 and HTTP/3 can be chosen.
|
||||
* Change: NTLM is now deprecated, though the option will stay for a while longer.
|
||||
* Add: HTTP Keepalive can be set in a handler.
|
||||
* Change: Option "tls_trusted_ca_certs" is now "tls_trust_pool".
|
||||
|
||||
1.5.7
|
||||
|
||||
@@ -87,17 +87,30 @@
|
||||
<help><![CDATA[Enter a path prefix like "/guacamole" that should be prepended to the upstream request because the application demands it.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>Load Balancing</label>
|
||||
<collapse>true</collapse>
|
||||
</field>
|
||||
<field>
|
||||
<id>handle.PassiveHealthFailDuration</id>
|
||||
<label>Upstream Fail Duration</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[Enables a passive health check when multiple destinations in "Upstream Domain" are set. "Fail Duration" is a value that defines how long to remember a failed request. A duration of 1 or more seconds enables passive health checking; the default is empty (off). A reasonable starting point might be 30s to balance error rates with responsiveness when bringing an unhealthy upstream back online.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>HTTP Transport</label>
|
||||
<collapse>true</collapse>
|
||||
</field>
|
||||
<field>
|
||||
<id>handle.HttpVersion</id>
|
||||
<label>HTTP Version</label>
|
||||
<type>dropdown</type>
|
||||
<help><![CDATA[The default versions are highly recommended. Choose a HTTP version for the upstream destination. HTTP/3 (HTTP over QUIC) requires TLS, and only establishes connections to webservers that also support HTTP/3.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>handle.HttpKeepalive</id>
|
||||
<label>HTTP Keepalive</label>
|
||||
<type>text</type>
|
||||
<hint>120</hint>
|
||||
<help><![CDATA[Leave empty to use default. Keepalive is either 0 (off) or a duration value that specifies how long to keep connections open (timeout) in seconds.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>Trust</label>
|
||||
@@ -109,18 +122,11 @@
|
||||
<type>checkbox</type>
|
||||
<help><![CDATA[Enable or disable HTTP over TLS (HTTPS) to communicate with the upstream destination. Caddy uses HTTP with the upstream destination by default.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>handle.HttpVersion</id>
|
||||
<label>HTTP Version</label>
|
||||
<type>dropdown</type>
|
||||
<help><![CDATA[The default versions are highly recommended. Choose a HTTP version for the upstream destination. HTTP/3 (HTTP over QUIC) requires TLS, and only establishes connections to webservers that also support HTTP/3.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>handle.HttpNtlm</id>
|
||||
<label>NTLM</label>
|
||||
<type>checkbox</type>
|
||||
<help><![CDATA[Enable or disable NTLM. Needed to reverse proxy an Exchange Server. Warning: NTLM has been deprecated by Microsoft. This option will be removed in the future when support for NTLM phases out.]]></help>
|
||||
<advanced>true</advanced>
|
||||
<help><![CDATA[Enable or disable NTLM. Needed to reverse proxy an Exchange Server. Warning: NTLM has been deprecated by Microsoft. This option will stay for as long as the optional http.reverse_proxy.transport.http_ntlm module can be compiled without errors.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>handle.HttpTlsInsecureSkipVerify</id>
|
||||
|
||||
@@ -335,6 +335,10 @@
|
||||
<http3>HTTP/3</http3>
|
||||
</OptionValues>
|
||||
</HttpVersion>
|
||||
<HttpKeepalive type="IntegerField">
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>86400</MaximumValue>
|
||||
</HttpKeepalive>
|
||||
<HttpNtlm type="BooleanField">
|
||||
<Constraints>
|
||||
<check001>
|
||||
|
||||
@@ -337,6 +337,7 @@
|
||||
<th data-column-id="ForwardAuth" data-type="boolean" data-formatter="boolean" data-visible="false">{{ lang._('Forward Auth') }}</th>
|
||||
<th data-column-id="HttpTls" data-type="boolean" data-formatter="boolean" data-visible="false">{{ lang._('TLS') }}</th>
|
||||
<th data-column-id="HttpVersion" data-type="string" data-visible="false">{{ lang._('HTTP Version') }}</th>
|
||||
<th data-column-id="HttpKeepalive" data-type="string" data-visible="false">{{ lang._('HTTP Keepalive') }}</th>
|
||||
<th data-column-id="HttpTlsTrustedCaCerts" data-type="string" data-visible="false">{{ lang._('TLS CA') }}</th>
|
||||
<th data-column-id="HttpTlsServerName" data-type="string" data-visible="false">{{ lang._('TLS Server Name') }}</th>
|
||||
<th data-column-id="HttpNtlm" data-type="boolean" data-formatter="boolean" data-visible="false">{{ lang._('NTLM') }}</th>
|
||||
|
||||
@@ -355,6 +355,7 @@
|
||||
# - HttpTlsServerName (string, optional): Specifies the server name for the TLS handshake.
|
||||
# - PassiveHealthFailDuration (integer, optional): Enables passive health checks when set > 0.
|
||||
# - HttpVersion (string, optional): Choose HTTP version. Empty (default) is 1.1 and 2.
|
||||
# - HttpKeepalive (string, optional): Keeaplive is either off (0) or a value. Empty (default) 120s.
|
||||
#}
|
||||
{% macro reverse_proxy_configuration(handle) %}
|
||||
{{ handle.HandleType }} {{ handle.HandlePath|default("") }} {
|
||||
@@ -374,7 +375,7 @@
|
||||
{% if handle.PassiveHealthFailDuration|default("") %}
|
||||
fail_duration {{ handle.PassiveHealthFailDuration }}s
|
||||
{% endif %}
|
||||
{% if handle.HttpTls|default("0") == "1" or handle.HttpTlsInsecureSkipVerify|default("0") == "1" or handle.HttpTlsTrustedCaCerts or handle.HttpTlsServerName or handle.HttpVersion %}
|
||||
{% if handle.HttpTls|default("0") == "1" or handle.HttpTlsInsecureSkipVerify|default("0") == "1" or handle.HttpTlsTrustedCaCerts or handle.HttpTlsServerName or handle.HttpVersion or handle.HttpKeepalive %}
|
||||
{% if handle.HttpNtlm|default("0") == "1" %}
|
||||
transport http_ntlm {
|
||||
{% if handle.HttpTls|default("0") == "1" %}
|
||||
@@ -397,6 +398,13 @@
|
||||
{% if handle.HttpVersion %}
|
||||
versions {{ version_map[handle.HttpVersion] }}
|
||||
{% endif %}
|
||||
{% if handle.HttpKeepalive %}
|
||||
{% if handle.HttpKeepalive == "0" %}
|
||||
keepalive off
|
||||
{% else %}
|
||||
keepalive {{ handle.HttpKeepalive }}s
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if handle.HttpTls|default("0") == "1" %}
|
||||
tls
|
||||
{% endif %}
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class CaddyCertificate extends BaseTableWidget {
|
||||
constructor() {
|
||||
super();
|
||||
this.resizeHandles = "e, w";
|
||||
this.tickTimeout = 30000;
|
||||
this.tickTimeout = 30;
|
||||
}
|
||||
|
||||
getGridOptions() {
|
||||
@@ -51,26 +51,22 @@ export default class CaddyCertificate extends BaseTableWidget {
|
||||
}
|
||||
|
||||
async onWidgetTick() {
|
||||
try {
|
||||
// Check if Caddy is enabled
|
||||
const caddyStatus = await ajaxGet('/api/caddy/reverse_proxy/get', {});
|
||||
if (!caddyStatus.caddy.general || caddyStatus.caddy.general.enabled === "0") {
|
||||
this.displayError(`${this.translations.unconfigured}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the certificate details
|
||||
const response = await ajaxGet('/api/caddy/diagnostics/certificate', {});
|
||||
if (response.status !== "success") {
|
||||
this.displayError(`${this.translations.nocerts}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Process certificates if the response is successful
|
||||
this.processCertificates(response.content);
|
||||
} catch (error) {
|
||||
this.displayError(`${this.translations.error}`);
|
||||
// Check if Caddy is enabled
|
||||
const caddyStatus = await this.ajaxGet('/api/caddy/reverse_proxy/get');
|
||||
if (!caddyStatus.caddy.general || caddyStatus.caddy.general.enabled === "0") {
|
||||
this.displayError(`${this.translations.unconfigured}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the certificate details
|
||||
const response = await this.ajaxGet('/api/caddy/diagnostics/certificate');
|
||||
if (response.status !== "success") {
|
||||
this.displayError(`${this.translations.nocerts}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Process certificates if the response is successful
|
||||
this.processCertificates(response.content);
|
||||
}
|
||||
|
||||
// Utility function to display errors within the widget
|
||||
|
||||
@@ -50,21 +50,16 @@ export default class CaddyDomain extends BaseTableWidget {
|
||||
}
|
||||
|
||||
async onWidgetTick() {
|
||||
try {
|
||||
// Check if caddy is enabled
|
||||
const data = await ajaxGet('/api/caddy/reverse_proxy/get', {});
|
||||
if (!data.caddy.general || data.caddy.general.enabled === "0") {
|
||||
this.displayError(`${this.translations.unconfigured}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Process domains if caddy is enabled
|
||||
let domains = { ...data.caddy.reverseproxy.reverse, ...data.caddy.reverseproxy.subdomain };
|
||||
this.processDomains(domains);
|
||||
|
||||
} catch (error) {
|
||||
this.displayError(`${this.translations.error}`);
|
||||
// Check if caddy is enabled
|
||||
const data = await this.ajaxGet('/api/caddy/reverse_proxy/get');
|
||||
if (!data.caddy.general || data.caddy.general.enabled === "0") {
|
||||
this.displayError(`${this.translations.unconfigured}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Process domains if caddy is enabled
|
||||
let domains = { ...data.caddy.reverseproxy.reverse, ...data.caddy.reverseproxy.subdomain };
|
||||
this.processDomains(domains);
|
||||
}
|
||||
|
||||
// Utility function to display errors within the widget
|
||||
|
||||
Reference in New Issue
Block a user