Allow custom proxy host header to be set (#393)
* ✨ feat: proxy header override * 🐛 fix: missing translations key * 🐛 fix: missing translations key, again 😅 * Update src/nginxconfig/i18n/en/templates/domain_sections/reverse_proxy.js Co-authored-by: Matt Cowley <me@mattcowley.co.uk> * 💡 chore: bump copyright year * 🎨 refactor: update key to proxyHostHeader and i18n messages * 🎨 refactor: fix key in template Co-authored-by: Matt Cowley <me@mattcowley.co.uk>pull/402/head
parent
4fabd0c0d9
commit
1afe9384fd
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -33,7 +33,6 @@ export default global => {
|
|||
config['# Proxy headers'] = '';
|
||||
config['proxy_set_header Upgrade'] = '$http_upgrade';
|
||||
config['proxy_set_header Connection'] = '$connection_upgrade';
|
||||
config['proxy_set_header Host'] = '$host';
|
||||
config['proxy_set_header X-Real-IP'] = '$remote_addr';
|
||||
config['proxy_set_header Forwarded'] = '$proxy_add_forwarded';
|
||||
if (global.reverseProxy.proxyCoexistenceXForwarded.computed == 'passOn') {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -279,6 +279,7 @@ export default (domain, domains, global, ipPortPairs) => {
|
|||
if (domain.reverseProxy.reverseProxy.computed) {
|
||||
const locConf = [];
|
||||
locConf.push(['proxy_pass', domain.reverseProxy.proxyPass.computed]);
|
||||
locConf.push(['proxy_set_header Host', domain.reverseProxy.proxyHostHeader.computed]);
|
||||
|
||||
if (global.tools.modularizedStructure.computed) {
|
||||
// Modularized
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy} kann nicht aktiviert werden, während ${common.php} aktiviert ist.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy} kann nicht aktiviert werden, während ${common.python} aktiviert ist.`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxy}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2020 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy} cannot be enabled whilst ${common.php} is enabled.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy} cannot be enabled whilst ${common.python} is enabled.`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header',
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy} no se puede habilitar mientras ${common.php} está habilitado.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy} no se puede habilitar mientras ${common.python} está habilitado.`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `Le ${common.reverseProxyLower} ne peut pas être activé en même temps que ${common.php}.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `Le ${common.reverseProxyLower} ne peut pas être activé en même temps que ${common.python}.`,
|
||||
enableReverseProxy: `${common.enable} le ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.php} が有効な場合は、 ${common.reverseProxy} を有効にすることはできません。`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.python} が有効な場合は、 ${common.reverseProxy} を有効にすることはできません。`,
|
||||
enableReverseProxy: `${common.reverseProxyLower}を${common.enable}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy} nie może zostać włączony dopóki włączony jest ${common.php}.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy} nie może zostać włączony dopóki włączony jest ${common.python}.`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2020 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `O ${common.reverseProxy} não pode ser habilitado enquanto o ${common.php} estiver habilitado.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `O ${common.reverseProxy} não pode ser habilitado enquanto o ${common.python} estiver habilitado.`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy} не может быть включен, пока включен ${common.php}.`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy} не может быть включен, пока включен ${common.python}.`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2020 DigitalOcean
|
||||
Copyright 2022 DigitalOcean
|
||||
|
||||
This code is licensed under the MIT License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy}在启用${common.php}时无法启用。`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy}在启用${common.python}时无法启用。`,
|
||||
enableReverseProxy: `${common.enable} ${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -31,4 +31,5 @@ export default {
|
|||
reverseProxyCannotBeEnabledWithPhp: `${common.reverseProxy} 在啟用 ${common.php} 時無法啟用。`,
|
||||
reverseProxyCannotBeEnabledWithPython: `${common.reverseProxy} 在啟用 ${common.python} 時無法啟用。`,
|
||||
enableReverseProxy: `${common.enable}${common.reverseProxyLower}`,
|
||||
proxyHostHeader: 'Proxy Host header', // TODO: translate
|
||||
};
|
||||
|
|
|
@ -99,6 +99,24 @@ THE SOFTWARE.
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="proxyHostHeaderEnabled" class="field is-horizontal">
|
||||
<div class="field-label">
|
||||
<label class="label">{{ $t('templates.domainSections.reverseProxy.proxyHostHeader') }}</label>
|
||||
</div>
|
||||
<div class="field-body">
|
||||
<div :class="`field${proxyHostHeaderChanged ? ' is-changed' : ''}`">
|
||||
<div class="control">
|
||||
<input
|
||||
v-model="proxyHostHeader"
|
||||
class="input"
|
||||
type="text"
|
||||
:placeholder="$props.data.proxyHostHeader.default"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -120,6 +138,10 @@ THE SOFTWARE.
|
|||
default: 'http://127.0.0.1:3000',
|
||||
enabled: false,
|
||||
},
|
||||
proxyHostHeader: {
|
||||
default: '$host',
|
||||
enabled: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
|
@ -157,11 +179,15 @@ THE SOFTWARE.
|
|||
this.$props.data.path.computed = this.$props.data.path.value;
|
||||
this.$props.data.proxyPass.enabled = true;
|
||||
this.$props.data.proxyPass.computed = this.$props.data.proxyPass.value;
|
||||
this.$props.data.proxyHostHeader.enabled = true;
|
||||
this.$props.data.proxyHostHeader.computed = this.$props.data.proxyHostHeader.value;
|
||||
} else {
|
||||
this.$props.data.path.enabled = false;
|
||||
this.$props.data.path.computed = '';
|
||||
this.$props.data.proxyPass.enabled = false;
|
||||
this.$props.data.proxyPass.computed = '';
|
||||
this.$props.data.proxyHostHeader.enabled = false;
|
||||
this.$props.data.proxyHostHeader.computed = '';
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
|
|
Loading…
Reference in New Issue