reuseport is not HTTP/3 only (#283)

* reuseport is not HTTP/3 only

* Forgot to remove these

* Move reuseport to global > https

* Update i18n files

* Only set reuseport once per ip:port pair

* Move reuseport opt outside ssl conditional

* Update copyright headers of touched files

Co-authored-by: MattIPv4 <me@mattcowley.co.uk>
pull/284/head
Daniel Walsh 2021-06-28 12:51:45 +01:00 committed by GitHub
parent fee8fb4189
commit 5330055f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 103 additions and 88 deletions

View File

@ -222,9 +222,10 @@ export default (domains, global) => {
// Single file configs // Single file configs
if (!global.tools.modularizedStructure.computed) { if (!global.tools.modularizedStructure.computed) {
const ipPortPairs = new Set();
for (const domain of domains) { for (const domain of domains) {
config.http.push([`# ${domain.server.domain.computed}`, '']); config.http.push([`# ${domain.server.domain.computed}`, '']);
config.http.push(...websiteConf(domain, domains, global)); config.http.push(...websiteConf(domain, domains, global, ipPortPairs));
} }
} }

View File

@ -56,56 +56,75 @@ const sslConfig = (domain, global) => {
return config; return config;
}; };
const httpsListen = domain => { const httpsListen = (domain, global, ipPortPairs) => {
const config = []; const config = [];
// Check if reuseport needs to be set
const ipPortV4 = `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443`;
const reusePortV4 = global.https.portReuse.computed && !ipPortPairs.has(ipPortV4);
if (reusePortV4) ipPortPairs.add(ipPortV4);
// HTTPS // HTTPS
config.push(['listen', config.push(['listen',
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}`]); `${ipPortV4} ssl${domain.https.http2.computed ? ' http2' : ''}${reusePortV4 ? ' reuseport' : ''}`]);
// HTTP/3 // HTTP/3
if (domain.https.http3.computed) if (domain.https.http3.computed)
config.push(['listen', config.push(['listen', `${ipPortV4} http3`]);
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`]);
// v6 // v6
if (domain.server.listenIpv6.computed) if (domain.server.listenIpv6.computed) {
config.push(['listen', // Check if reuseport needs to be set
`[${domain.server.listenIpv6.computed}]:443 ssl${domain.https.http2.computed ? ' http2' : ''}`]); const ipPortV6 = `[${domain.server.listenIpv6.computed}]:443`;
const reusePortV6 = global.https.portReuse.computed && !ipPortPairs.has(ipPortV6);
if (reusePortV6) ipPortPairs.add(ipPortV6);
// v6 HTTP/3 // HTTPS
if (domain.server.listenIpv6.computed && domain.https.http3.computed)
config.push(['listen', config.push(['listen',
`[${domain.server.listenIpv6.computed}]:443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`]); `${ipPortV6} ssl${domain.https.http2.computed ? ' http2' : ''}${reusePortV6 ? ' reuseport' : ''}`]);
// HTTP/3
if (domain.https.http3.computed)
config.push(['listen', `${ipPortV6} http3`]);
}
return config; return config;
}; };
const httpListen = domain => { const httpListen = (domain, global, ipPortPairs) => {
const config = []; const config = [];
// Not HTTPS // Check if reuseport needs to be set
config.push(['listen', const ipPortV4 = `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`;
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]); const reusePortV4 = global.https.portReuse.computed && !ipPortPairs.has(ipPortV4);
if (reusePortV4) ipPortPairs.add(ipPortV4);
// v4
config.push(['listen', `${ipPortV4}${reusePortV4 ? ' reuseport' : ''}`]);
// v6 // v6
if (domain.server.listenIpv6.computed) if (domain.server.listenIpv6.computed) {
config.push(['listen', `[${domain.server.listenIpv6.computed}]:80`]); // Check if reuseport needs to be set
const ipPortV6 = `[${domain.server.listenIpv6.computed}]:80`;
const reusePortV6 = global.https.portReuse.computed && !ipPortPairs.has(ipPortV6);
if (reusePortV6) ipPortPairs.add(ipPortV6);
config.push(['listen', `${ipPortV6}${reusePortV6 ? ' reuseport' : ''}`]);
}
return config; return config;
}; };
const listenConfig = domain => { const listenConfig = (domain, global, ipPortPairs) => {
if (domain.https.https.computed) return httpsListen(domain); if (domain.https.https.computed) return httpsListen(domain, global, ipPortPairs);
return httpListen(domain); return httpListen(domain, global, ipPortPairs);
}; };
const httpRedirectConfig = (domain, global, ipPortPairs, domainName, redirectDomain) => {
const httpRedirectConfig = (domain, global, domainName, redirectDomain) => {
// Build the server config on its own before adding it to the parent config // Build the server config on its own before adding it to the parent config
const config = []; const config = [];
config.push(...httpListen(domain)); config.push(...httpListen(domain, global, ipPortPairs));
config.push(['server_name', domainName]); config.push(['server_name', domainName]);
if (domain.https.certType.computed === 'letsEncrypt') { if (domain.https.certType.computed === 'letsEncrypt') {
@ -130,7 +149,7 @@ const httpRedirectConfig = (domain, global, domainName, redirectDomain) => {
return config; return config;
}; };
export default (domain, domains, global) => { export default (domain, domains, global, ipPortPairs) => {
// Use kv so we can use the same key multiple times // Use kv so we can use the same key multiple times
const config = []; const config = [];
@ -138,10 +157,12 @@ export default (domain, domains, global) => {
const serverConfig = []; const serverConfig = [];
// Not HTTPS or not force HTTPS // Not HTTPS or not force HTTPS
if (!domain.https.https.computed || !domain.https.forceHttps.computed) serverConfig.push(...httpListen(domain)); if (!domain.https.https.computed || !domain.https.forceHttps.computed)
serverConfig.push(...httpListen(domain, global, ipPortPairs));
// HTTPS // HTTPS
if (domain.https.https.computed) serverConfig.push(...httpsListen(domain)); if (domain.https.https.computed)
serverConfig.push(...httpsListen(domain, global, ipPortPairs));
serverConfig.push(['server_name', serverConfig.push(['server_name',
`${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}`]); `${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}`]);
@ -340,7 +361,7 @@ export default (domain, domains, global) => {
// Build the server config on its own before adding it to the parent config // Build the server config on its own before adding it to the parent config
const cdnConfig = []; const cdnConfig = [];
cdnConfig.push(...listenConfig(domain)); cdnConfig.push(...listenConfig(domain, global, ipPortPairs));
cdnConfig.push(['server_name', `cdn.${domain.server.domain.computed}`]); cdnConfig.push(['server_name', `cdn.${domain.server.domain.computed}`]);
cdnConfig.push(['root', `${domain.server.path.computed}${domain.server.documentRoot.computed}`]); cdnConfig.push(['root', `${domain.server.path.computed}${domain.server.documentRoot.computed}`]);
@ -383,7 +404,7 @@ export default (domain, domains, global) => {
// Build the server config on its own before adding it to the parent config // Build the server config on its own before adding it to the parent config
const redirectConfig = []; const redirectConfig = [];
redirectConfig.push(...listenConfig(domain)); redirectConfig.push(...listenConfig(domain, global, ipPortPairs));
redirectConfig.push(['server_name', redirectConfig.push(['server_name',
`${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]); `${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]);
@ -403,17 +424,21 @@ export default (domain, domains, global) => {
// Add the redirect config to the parent config now its built // Add the redirect config to the parent config now its built
config.push(['# HTTP redirect', '']); config.push(['# HTTP redirect', '']);
if (domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) { if (domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) {
config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed, config.push(['server', httpRedirectConfig(domain, global, ipPortPairs,
domain.server.domain.computed, `www.${domain.server.domain.computed}`)]);
config.push(['server', httpRedirectConfig(domain, global, ipPortPairs,
`www.${domain.server.domain.computed}`)]); `www.${domain.server.domain.computed}`)]);
config.push(['server', httpRedirectConfig(domain, global, `www.${domain.server.domain.computed}`)]);
} else if (!domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) { } else if (!domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) {
config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed)]); config.push(['server', httpRedirectConfig(domain, global, ipPortPairs,
domain.server.domain.computed)]);
} }
if (domain.server.cdnSubdomain.computed) { if (domain.server.cdnSubdomain.computed) {
config.push(['server', httpRedirectConfig(domain, global, `cdn.${domain.server.domain.computed}`)]); config.push(['server', httpRedirectConfig(domain, global, ipPortPairs,
`cdn.${domain.server.domain.computed}`)]);
} }
if (domain.server.redirectSubdomains.computed) { if (domain.server.redirectSubdomains.computed) {
config.push(['server', httpRedirectConfig(domain, global, `.${domain.server.domain.computed}`, config.push(['server', httpRedirectConfig(domain, global, ipPortPairs,
`.${domain.server.domain.computed}`,
`${domain.server.wwwSubdomain.computed ? 'www.' : '' }${domain.server.domain.computed}`)]); `${domain.server.wwwSubdomain.computed ? 'www.' : '' }${domain.server.domain.computed}`)]);
} }
} }

View File

@ -57,8 +57,10 @@ export default (domains, global) => {
// Modularised configs // Modularised configs
if (global.tools.modularizedStructure.computed) { if (global.tools.modularizedStructure.computed) {
// Domain config // Domain config
const sitesDir = `sites-${global.tools.symlinkVhost.computed ? 'available' : 'enabled'}`;
const ipPortPairs = new Set();
for (const domain of domains) { for (const domain of domains) {
files[`sites-${global.tools.symlinkVhost.computed ? 'available' : 'enabled'}/${domain.server.domain.computed}.conf`] = toConf(websiteConf(domain, domains, global)); files[`${sitesDir}/${domain.server.domain.computed}.conf`] = toConf(websiteConf(domain, domains, global, ipPortPairs));
} }
// Let's encrypt // Let's encrypt

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} ${common.http}/2 connections`, enableHttp2Connections: `${common.enable} ${common.http}/2 connections`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} ${common.http}/3 connections`, enableHttp3Connections: `${common.enable} ${common.http}/3 connections`,
portReuse: 'Reuseport',
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`,
forceHttps: `Force ${common.https}`, forceHttps: `Force ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable} Strict Transport Security, requiring HTTPS connections`, enableStrictTransportSecurity: `${common.enable} Strict Transport Security, requiring HTTPS connections`,

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2020 DigitalOcean Copyright 2021 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `${common.ssl} Profile`, sslProfile: `${common.ssl} Profile`,
httpsMustBeEnabledOnOneSite: `${common.https} must be enabled on at least one site to configure global ${common.https} settings.`, httpsMustBeEnabledOnOneSite: `${common.https} must be enabled on at least one site to configure global ${common.https} settings.`,
portReuse: 'Reuseport',
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`,
ocspDnsResolvers: 'OCSP DNS Resolvers', ocspDnsResolvers: 'OCSP DNS Resolvers',
cloudflareResolver: 'Cloudflare Resolver', cloudflareResolver: 'Cloudflare Resolver',
googlePublicDns: 'Google Public DNS', googlePublicDns: 'Google Public DNS',

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} les connexions ${common.http}/2`, enableHttp2Connections: `${common.enable} les connexions ${common.http}/2`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} les connexions ${common.http}/3`, enableHttp3Connections: `${common.enable} les connexions ${common.http}/3`,
portReuse: 'Reuseport', // TODO: translate
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, // TODO: translate
forceHttps: `Forcer ${common.https}`, forceHttps: `Forcer ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable} Strict Transport Security, exigeant HTTPS`, enableStrictTransportSecurity: `${common.enable} Strict Transport Security, exigeant HTTPS`,

View File

@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `Profil ${common.ssl}`, sslProfile: `Profil ${common.ssl}`,
httpsMustBeEnabledOnOneSite: `${common.https} doit être activé sur au moins un site pour configurer les paramètres ${common.https} globaux.`, httpsMustBeEnabledOnOneSite: `${common.https} doit être activé sur au moins un site pour configurer les paramètres ${common.https} globaux.`,
portReuse: 'Reuseport', // TODO: translate
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, // TODO: translate
ocspDnsResolvers: 'Résolveur DNS OCSP', ocspDnsResolvers: 'Résolveur DNS OCSP',
cloudflareResolver: 'Résolveur Cloudflare', cloudflareResolver: 'Résolveur Cloudflare',
googlePublicDns: 'Google Public DNS', googlePublicDns: 'Google Public DNS',

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} połączenia ${common.http}/2`, enableHttp2Connections: `${common.enable} połączenia ${common.http}/2`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} połączenia ${common.http}/3`, enableHttp3Connections: `${common.enable} połączenia ${common.http}/3`,
portReuse: 'Reuseport',
enableReuseOfPort: `${common.enable} reuseport aby generować listening socket per worker`,
forceHttps: `Wymuś ${common.https}`, forceHttps: `Wymuś ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable} Strict Transport Security, wymaga połaczenia HTTPS`, enableStrictTransportSecurity: `${common.enable} Strict Transport Security, wymaga połaczenia HTTPS`,

View File

@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `Profil ${common.ssl}`, sslProfile: `Profil ${common.ssl}`,
httpsMustBeEnabledOnOneSite: `${common.https} musi być włączony na conajmniej jednej stronie, aby móc zastosować globalną konfigurację ${common.https}.`, httpsMustBeEnabledOnOneSite: `${common.https} musi być włączony na conajmniej jednej stronie, aby móc zastosować globalną konfigurację ${common.https}.`,
portReuse: 'Reuseport',
enableReuseOfPort: `${common.enable} reuseport aby generować listening socket per worker`,
ocspDnsResolvers: 'OCSP DNS Resolvers', ocspDnsResolvers: 'OCSP DNS Resolvers',
cloudflareResolver: 'Cloudflare Resolver', cloudflareResolver: 'Cloudflare Resolver',
googlePublicDns: 'Google Public DNS', googlePublicDns: 'Google Public DNS',

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} conexões ${common.http}/2`, enableHttp2Connections: `${common.enable} conexões ${common.http}/2`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} conexões ${common.http}/3`, enableHttp3Connections: `${common.enable} conexões ${common.http}/3`,
portReuse: 'Reuseport', // TODO: translate
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, // TODO: translate
forceHttps: `Forçar ${common.https}`, forceHttps: `Forçar ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable} Strict Transport Security, requerendo conexões HTTPS`, enableStrictTransportSecurity: `${common.enable} Strict Transport Security, requerendo conexões HTTPS`,

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2020 DigitalOcean Copyright 2021 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `Perfil ${common.ssl}`, sslProfile: `Perfil ${common.ssl}`,
httpsMustBeEnabledOnOneSite: `O ${common.https} deve estar habilitado em pelo menos um site para definir as configurações globais de ${common.https}.`, httpsMustBeEnabledOnOneSite: `O ${common.https} deve estar habilitado em pelo menos um site para definir as configurações globais de ${common.https}.`,
portReuse: 'Reuseport', // TODO: translate
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, // TODO: translate
ocspDnsResolvers: 'Resolvedores de DNS OCSP', ocspDnsResolvers: 'Resolvedores de DNS OCSP',
cloudflareResolver: 'Resolvedor Cloudflare', cloudflareResolver: 'Resolvedor Cloudflare',
googlePublicDns: 'DNS público do Google', googlePublicDns: 'DNS público do Google',

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} ${common.http}/2 соединения`, enableHttp2Connections: `${common.enable} ${common.http}/2 соединения`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} ${common.http}/3 соединения`, enableHttp3Connections: `${common.enable} ${common.http}/3 соединения`,
portReuse: 'Reuseport', // TODO: translate
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, // TODO: translate
forceHttps: `Использовать только ${common.https}`, forceHttps: `Использовать только ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable} Strict Transport Security, требующая HTTPS соединения`, enableStrictTransportSecurity: `${common.enable} Strict Transport Security, требующая HTTPS соединения`,

View File

@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `${common.ssl} Профиль`, sslProfile: `${common.ssl} Профиль`,
httpsMustBeEnabledOnOneSite: `${common.https} должен быть включен хотя бы на одном сайте, чтобы сконфигурировать глобальные ${common.https} настройки.`, httpsMustBeEnabledOnOneSite: `${common.https} должен быть включен хотя бы на одном сайте, чтобы сконфигурировать глобальные ${common.https} настройки.`,
portReuse: 'Reuseport', // TODO: translate
enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, // TODO: translate
ocspDnsResolvers: 'OCSP DNS Преобразователи', ocspDnsResolvers: 'OCSP DNS Преобразователи',
cloudflareResolver: 'Cloudflare Преобразователь', cloudflareResolver: 'Cloudflare Преобразователь',
googlePublicDns: 'Публичные Google DNS', googlePublicDns: 'Публичные Google DNS',

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} ${common.http}/2 连接`, enableHttp2Connections: `${common.enable} ${common.http}/2 连接`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} ${common.http}/3 连接`, enableHttp3Connections: `${common.enable} ${common.http}/3 连接`,
portReuse: '端口重用',
enableReuseOfPort: `${common.enable} 重用端口 为每个 NGINX Worker 单独生成一个监听套接字`,
forceHttps: `强制 ${common.https}`, forceHttps: `强制 ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable}HSTS强制客户端、浏览器等使用 HTTPS 与服务器创建链接需要HTTPS连接`, enableStrictTransportSecurity: `${common.enable}HSTS强制客户端、浏览器等使用 HTTPS 与服务器创建链接需要HTTPS连接`,

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2020 DigitalOcean Copyright 2021 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `${common.ssl}配置`, sslProfile: `${common.ssl}配置`,
httpsMustBeEnabledOnOneSite: `必须在至少一个站点上启用${common.https}才能配置全局${common.https}设置。`, httpsMustBeEnabledOnOneSite: `必须在至少一个站点上启用${common.https}才能配置全局${common.https}设置。`,
portReuse: '端口重用',
enableReuseOfPort: `${common.enable} 重用端口 为每个 NGINX Worker 单独生成一个监听套接字`,
ocspDnsResolvers: 'OCSP DNS解析器', ocspDnsResolvers: 'OCSP DNS解析器',
cloudflareResolver: 'Cloudflare解析器', cloudflareResolver: 'Cloudflare解析器',
googlePublicDns: '谷歌公共DNS', googlePublicDns: '谷歌公共DNS',

View File

@ -32,8 +32,6 @@ export default {
enableHttp2Connections: `${common.enable} ${common.http}/2 連接`, enableHttp2Connections: `${common.enable} ${common.http}/2 連接`,
http3: `${common.http}/3`, http3: `${common.http}/3`,
enableHttp3Connections: `${common.enable} ${common.http}/3 連接`, enableHttp3Connections: `${common.enable} ${common.http}/3 連接`,
portReuse: '端口複用',
enableReuseOfPort: `${common.enable} 端口複用來為每個worker生成監聽套接字`,
forceHttps: `強制 ${common.https}`, forceHttps: `強制 ${common.https}`,
hsts: 'HSTS', hsts: 'HSTS',
enableStrictTransportSecurity: `${common.enable}HSTS強制用戶端、瀏覽器等使用HTTPS與服務器創建連結需要HTTPS連接`, enableStrictTransportSecurity: `${common.enable}HSTS強制用戶端、瀏覽器等使用HTTPS與服務器創建連結需要HTTPS連接`,

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2020 DigitalOcean Copyright 2021 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -33,6 +33,8 @@ const ipv6 = 'IPv6';
export default { export default {
sslProfile: `${common.ssl}配寘`, sslProfile: `${common.ssl}配寘`,
httpsMustBeEnabledOnOneSite: `必須在至少一個網站上啟用${common.https}才能配寘全域${common.https}設定。`, httpsMustBeEnabledOnOneSite: `必須在至少一個網站上啟用${common.https}才能配寘全域${common.https}設定。`,
portReuse: '端口複用',
enableReuseOfPort: `${common.enable} 端口複用來為每個worker生成監聽套接字`,
ocspDnsResolvers: 'OCSP DNS解析器', ocspDnsResolvers: 'OCSP DNS解析器',
cloudflareResolver: 'Cloudflare解析器', cloudflareResolver: 'Cloudflare解析器',
googlePublicDns: '穀歌公共DNS', googlePublicDns: '穀歌公共DNS',

View File

@ -96,24 +96,6 @@ THE SOFTWARE.
</div> </div>
</div> </div>
<div v-if="portReuseEnabled" class="field is-horizontal">
<div class="field-label">
<label class="label">{{ $t('templates.domainSections.https.portReuse') }}</label>
</div>
<div class="field-body">
<div class="field">
<div :class="`control${portReuseChanged ? ' is-changed' : ''}`">
<div class="checkbox">
<PrettyCheck v-model="portReuse" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ $t('templates.domainSections.https.enableReuseOfPort') }}
</PrettyCheck>
</div>
</div>
</div>
</div>
</div>
<div v-if="forceHttpsEnabled" class="field is-horizontal"> <div v-if="forceHttpsEnabled" class="field is-horizontal">
<div class="field-label"> <div class="field-label">
<label class="label">{{ $t('templates.domainSections.https.forceHttps') }}</label> <label class="label">{{ $t('templates.domainSections.https.forceHttps') }}</label>
@ -263,10 +245,6 @@ THE SOFTWARE.
default: false, default: false,
enabled: true, enabled: true,
}, },
portReuse: {
default: true,
enabled: false,
},
forceHttps: { forceHttps: {
default: true, default: true,
enabled: true, enabled: true,
@ -359,19 +337,6 @@ THE SOFTWARE.
}, },
deep: true, deep: true,
}, },
// Only allow port reuse when HTTP/3 is enabled first
'$props.data.http3': {
handler(data) {
if (data.computed) {
this.$props.data.portReuse.enabled = true;
this.$props.data.portReuse.computed = this.$props.data.portReuse.value;
} else {
this.$props.data.portReuse.enabled = false;
this.$props.data.portReuse.computed = false;
}
},
deep: true,
},
// Disable hsts options if hsts is disabled // Disable hsts options if hsts is disabled
'$props.data': { '$props.data': {
handler() { handler() {

View File

@ -1,5 +1,5 @@
<!-- <!--
Copyright 2020 DigitalOcean Copyright 2021 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -26,6 +26,24 @@ THE SOFTWARE.
<template> <template>
<div> <div>
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ $t('templates.globalSections.https.portReuse') }}</label>
</div>
<div class="field-body">
<div class="field">
<div :class="`control${portReuseChanged ? ' is-changed' : ''}`">
<div class="checkbox">
<PrettyCheck v-model="portReuse" class="p-default p-curve p-fill p-icon">
<i slot="extra" class="icon fas fa-check"></i>
{{ $t('templates.globalSections.https.enableReuseOfPort') }}
</PrettyCheck>
</div>
</div>
</div>
</div>
</div>
<div v-if="!sslProfileEnabled" class="field is-horizontal is-aligned-top"> <div v-if="!sslProfileEnabled" class="field is-horizontal is-aligned-top">
<div class="field-label"> <div class="field-label">
<label class="label">{{ $t('templates.globalSections.https.sslProfile') }}</label> <label class="label">{{ $t('templates.globalSections.https.sslProfile') }}</label>
@ -239,6 +257,10 @@ THE SOFTWARE.
}; };
const defaults = { const defaults = {
portReuse: {
default: false,
enabled: true,
},
sslProfile: { sslProfile: {
default: 'intermediate', default: 'intermediate',
options: { options: {