Commit 7f4135d7 authored by nanahira's avatar nanahira

add specify sni and host

parent 40fc904e
Pipeline #22803 passed with stages
in 6 minutes and 14 seconds
...@@ -36,6 +36,8 @@ export interface ProxyRenderData extends SiteRenderData { ...@@ -36,6 +36,8 @@ export interface ProxyRenderData extends SiteRenderData {
noVerifyCerts?: boolean; noVerifyCerts?: boolean;
noBuffer?: boolean; noBuffer?: boolean;
sni?: boolean; sni?: boolean;
sniName?: string;
hostHeader?: string;
noCache?: boolean; noCache?: boolean;
} }
...@@ -136,12 +138,15 @@ async function getSiteData( ...@@ -136,12 +138,15 @@ async function getSiteData(
code: parser.getNumber('REDIRECT_CODE') || 301, code: parser.getNumber('REDIRECT_CODE') || 301,
} as RedirectRenderData; } as RedirectRenderData;
} else { } else {
const sni = parser.getString('SNI');
specificRenderData = { specificRenderData = {
proxy: true, proxy: true,
upstream: input[`SITE_${domain}`], upstream: input[`SITE_${domain}`],
noVerifyCerts: parser.getBoolean('NO_VERIFY_CERTS'), noVerifyCerts: parser.getBoolean('NO_VERIFY_CERTS'),
noBuffer: parser.getBoolean('NO_BUFFER'), noBuffer: parser.getBoolean('NO_BUFFER'),
sni: parser.getBoolean('SNI'), sni: sni === '1',
sniName: sni === '1' ? undefined : sni,
hostHeader: parser.getString('HOST'),
noCache: parser.getBoolean('NO_CACHE'), noCache: parser.getBoolean('NO_CACHE'),
minio: parser.getBoolean('MINIO'), minio: parser.getBoolean('MINIO'),
timeout: parser.getNumber('TIMEOUT'), timeout: parser.getNumber('TIMEOUT'),
......
...@@ -217,7 +217,12 @@ http { ...@@ -217,7 +217,12 @@ http {
{{/timeout}} {{/timeout}}
{{^minio}} {{^minio}}
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host; {{#hostHeader}}
proxy_set_header Host {{.}};
{{/hostHeader}}
{{^hostHeader}}
proxy_set_header Host $host;
{{/hostHeader}}
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
{{/minio}} {{/minio}}
...@@ -238,6 +243,9 @@ http { ...@@ -238,6 +243,9 @@ http {
{{#sni}} {{#sni}}
proxy_ssl_server_name on; proxy_ssl_server_name on;
{{/sni}} {{/sni}}
{{#sniName}}
proxy_ssl_name {{.}};
{{/sniName}}
{{#noCache}} {{#noCache}}
proxy_cache off; proxy_cache off;
{{/noCache}} {{/noCache}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment