From 6ce012c9a141213044522e5d1826c90bcd741adb Mon Sep 17 00:00:00 2001 From: Chongyi Zheng Date: Tue, 12 Jul 2022 22:45:54 -0400 Subject: [PATCH] Add trust proxy checkbox in Settings page --- src/components/settings/ReverseProxy.vue | 47 ++++++++++++++++++++++++ src/languages/en.js | 4 ++ src/pages/Settings.vue | 4 ++ 3 files changed, 55 insertions(+) diff --git a/src/components/settings/ReverseProxy.vue b/src/components/settings/ReverseProxy.vue index 616b0996e..85046cc20 100644 --- a/src/components/settings/ReverseProxy.vue +++ b/src/components/settings/ReverseProxy.vue @@ -91,6 +91,47 @@ {{ $t("For example: nginx, Apache and Traefik.") }}
{{ $t("Please read") }} https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy. + +

{{ $t("HTTP Headers") }}

+
+ +
+ + +
+
+ + +
+
+ +
+ +
@@ -113,6 +154,12 @@ export default { settings() { return this.$parent.$parent.$parent.settings; }, + saveSettings() { + return this.$parent.$parent.$parent.saveSettings; + }, + settingsLoaded() { + return this.$parent.$parent.$parent.settingsLoaded; + }, }, watch: { diff --git a/src/languages/en.js b/src/languages/en.js index 9aeedd9de..3c3cdff41 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -453,6 +453,10 @@ export default { "Message:": "Message:", "Don't know how to get the token? Please read the guide:": "Don't know how to get the token? Please read the guide:", "The current connection may be lost if you are currently connecting via Cloudflare Tunnel. Are you sure want to stop it? Type your current password to confirm it.": "The current connection may be lost if you are currently connecting via Cloudflare Tunnel. Are you sure want to stop it? Type your current password to confirm it.", + "HTTP Headers": "HTTP Headers", + "Trust Proxy": "Trust Proxy", + "Trust 'X-Forwarded-*' headers": "Trust 'X-Forwarded-*' headers", + "Don't trust 'X-Forwarded-*' headers": "Don't trust 'X-Forwarded-*' headers", "Other Software": "Other Software", "For example: nginx, Apache and Traefik.": "For example: nginx, Apache and Traefik.", "Please read": "Please read", diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index 03eb09e92..e10137898 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -153,6 +153,10 @@ export default { this.settings.tlsExpiryNotifyDays = [ 7, 14, 21 ]; } + if (this.settings.trustProxy === undefined) { + this.settings.trustProxy = false; + } + this.settingsLoaded = true; }); },