unplugin-https-reverse-proxy 1.0.0-beta.18 → 1.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZDL3GBDQ.js → chunk-I6DP2OII.js} +29 -4
- package/dist/esbuild.cjs +29 -4
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +29 -4
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +29 -4
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/rollup.cjs +29 -4
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +29 -4
- package/dist/rspack.js +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/vite.cjs +29 -4
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +29 -4
- package/dist/webpack.js +1 -1
- package/package.json +1 -1
- package/src/caddy/index.ts +28 -5
|
@@ -391,7 +391,23 @@ var CaddyInstant = class {
|
|
|
391
391
|
this.caddyfile = `${this.caddyfile}
|
|
392
392
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
393
393
|
${https ? "tls internal" : ""}
|
|
394
|
-
reverse_proxy http://${source}
|
|
394
|
+
reverse_proxy http://${source} {
|
|
395
|
+
health_uri /
|
|
396
|
+
health_interval 2s
|
|
397
|
+
health_timeout 5s
|
|
398
|
+
fail_duration 2s
|
|
399
|
+
unhealthy_status 502 503 504 404
|
|
400
|
+
lb_try_duration 3s
|
|
401
|
+
lb_try_interval 300ms
|
|
402
|
+
|
|
403
|
+
@error status 502 503 504 404
|
|
404
|
+
handle_response @error {
|
|
405
|
+
respond * 503 {
|
|
406
|
+
body "Service Unavailable"
|
|
407
|
+
close
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
395
411
|
}
|
|
396
412
|
|
|
397
413
|
`;
|
|
@@ -458,14 +474,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
458
474
|
this._caddyChild.on("error", (err) => {
|
|
459
475
|
return reject(err);
|
|
460
476
|
});
|
|
461
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
477
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
462
478
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
463
479
|
for (const line of lines) {
|
|
464
480
|
showCaddyLog && line && console.info(line);
|
|
465
481
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
466
|
-
|
|
482
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
483
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
484
|
+
|
|
485
|
+
${line}
|
|
486
|
+
`);
|
|
487
|
+
await this.baseCleanup();
|
|
488
|
+
process3.exit();
|
|
489
|
+
} else {
|
|
490
|
+
consola.error(`${line}
|
|
467
491
|
`);
|
|
468
|
-
|
|
492
|
+
return reject(line);
|
|
493
|
+
}
|
|
469
494
|
}
|
|
470
495
|
if (line.includes("config file changed"))
|
|
471
496
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/esbuild.cjs
CHANGED
|
@@ -460,7 +460,23 @@ var CaddyInstant = class {
|
|
|
460
460
|
this.caddyfile = `${this.caddyfile}
|
|
461
461
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
462
462
|
${https ? "tls internal" : ""}
|
|
463
|
-
reverse_proxy http://${source}
|
|
463
|
+
reverse_proxy http://${source} {
|
|
464
|
+
health_uri /
|
|
465
|
+
health_interval 2s
|
|
466
|
+
health_timeout 5s
|
|
467
|
+
fail_duration 2s
|
|
468
|
+
unhealthy_status 502 503 504 404
|
|
469
|
+
lb_try_duration 3s
|
|
470
|
+
lb_try_interval 300ms
|
|
471
|
+
|
|
472
|
+
@error status 502 503 504 404
|
|
473
|
+
handle_response @error {
|
|
474
|
+
respond * 503 {
|
|
475
|
+
body "Service Unavailable"
|
|
476
|
+
close
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
464
480
|
}
|
|
465
481
|
|
|
466
482
|
`;
|
|
@@ -527,14 +543,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
527
543
|
this._caddyChild.on("error", (err) => {
|
|
528
544
|
return reject(err);
|
|
529
545
|
});
|
|
530
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
546
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
531
547
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
532
548
|
for (const line of lines) {
|
|
533
549
|
showCaddyLog && line && console.info(line);
|
|
534
550
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
535
|
-
|
|
551
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
552
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
553
|
+
|
|
554
|
+
${line}
|
|
555
|
+
`);
|
|
556
|
+
await this.baseCleanup();
|
|
557
|
+
import_node_process4.default.exit();
|
|
558
|
+
} else {
|
|
559
|
+
consola.error(`${line}
|
|
536
560
|
`);
|
|
537
|
-
|
|
561
|
+
return reject(line);
|
|
562
|
+
}
|
|
538
563
|
}
|
|
539
564
|
if (line.includes("config file changed"))
|
|
540
565
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -460,7 +460,23 @@ var CaddyInstant = class {
|
|
|
460
460
|
this.caddyfile = `${this.caddyfile}
|
|
461
461
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
462
462
|
${https ? "tls internal" : ""}
|
|
463
|
-
reverse_proxy http://${source}
|
|
463
|
+
reverse_proxy http://${source} {
|
|
464
|
+
health_uri /
|
|
465
|
+
health_interval 2s
|
|
466
|
+
health_timeout 5s
|
|
467
|
+
fail_duration 2s
|
|
468
|
+
unhealthy_status 502 503 504 404
|
|
469
|
+
lb_try_duration 3s
|
|
470
|
+
lb_try_interval 300ms
|
|
471
|
+
|
|
472
|
+
@error status 502 503 504 404
|
|
473
|
+
handle_response @error {
|
|
474
|
+
respond * 503 {
|
|
475
|
+
body "Service Unavailable"
|
|
476
|
+
close
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
464
480
|
}
|
|
465
481
|
|
|
466
482
|
`;
|
|
@@ -527,14 +543,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
527
543
|
this._caddyChild.on("error", (err) => {
|
|
528
544
|
return reject(err);
|
|
529
545
|
});
|
|
530
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
546
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
531
547
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
532
548
|
for (const line of lines) {
|
|
533
549
|
showCaddyLog && line && console.info(line);
|
|
534
550
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
535
|
-
|
|
551
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
552
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
553
|
+
|
|
554
|
+
${line}
|
|
555
|
+
`);
|
|
556
|
+
await this.baseCleanup();
|
|
557
|
+
import_node_process4.default.exit();
|
|
558
|
+
} else {
|
|
559
|
+
consola.error(`${line}
|
|
536
560
|
`);
|
|
537
|
-
|
|
561
|
+
return reject(line);
|
|
562
|
+
}
|
|
538
563
|
}
|
|
539
564
|
if (line.includes("config file changed"))
|
|
540
565
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -462,7 +462,23 @@ var CaddyInstant = class {
|
|
|
462
462
|
this.caddyfile = `${this.caddyfile}
|
|
463
463
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
464
464
|
${https ? "tls internal" : ""}
|
|
465
|
-
reverse_proxy http://${source}
|
|
465
|
+
reverse_proxy http://${source} {
|
|
466
|
+
health_uri /
|
|
467
|
+
health_interval 2s
|
|
468
|
+
health_timeout 5s
|
|
469
|
+
fail_duration 2s
|
|
470
|
+
unhealthy_status 502 503 504 404
|
|
471
|
+
lb_try_duration 3s
|
|
472
|
+
lb_try_interval 300ms
|
|
473
|
+
|
|
474
|
+
@error status 502 503 504 404
|
|
475
|
+
handle_response @error {
|
|
476
|
+
respond * 503 {
|
|
477
|
+
body "Service Unavailable"
|
|
478
|
+
close
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
466
482
|
}
|
|
467
483
|
|
|
468
484
|
`;
|
|
@@ -529,14 +545,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
529
545
|
this._caddyChild.on("error", (err) => {
|
|
530
546
|
return reject(err);
|
|
531
547
|
});
|
|
532
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
548
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
533
549
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
534
550
|
for (const line of lines) {
|
|
535
551
|
showCaddyLog && line && console.info(line);
|
|
536
552
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
537
|
-
|
|
553
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
554
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
555
|
+
|
|
556
|
+
${line}
|
|
557
|
+
`);
|
|
558
|
+
await this.baseCleanup();
|
|
559
|
+
import_node_process4.default.exit();
|
|
560
|
+
} else {
|
|
561
|
+
consola.error(`${line}
|
|
538
562
|
`);
|
|
539
|
-
|
|
563
|
+
return reject(line);
|
|
564
|
+
}
|
|
540
565
|
}
|
|
541
566
|
if (line.includes("config file changed"))
|
|
542
567
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/nuxt.d.cts
CHANGED
|
@@ -3,6 +3,6 @@ import { Options } from './types.cjs';
|
|
|
3
3
|
|
|
4
4
|
interface ModuleOptions extends Options {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions
|
|
6
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
7
7
|
|
|
8
8
|
export { type ModuleOptions, _default as default };
|
package/dist/nuxt.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import { Options } from './types.js';
|
|
|
3
3
|
|
|
4
4
|
interface ModuleOptions extends Options {
|
|
5
5
|
}
|
|
6
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions
|
|
6
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
7
7
|
|
|
8
8
|
export { type ModuleOptions, _default as default };
|
package/dist/nuxt.js
CHANGED
package/dist/rollup.cjs
CHANGED
|
@@ -460,7 +460,23 @@ var CaddyInstant = class {
|
|
|
460
460
|
this.caddyfile = `${this.caddyfile}
|
|
461
461
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
462
462
|
${https ? "tls internal" : ""}
|
|
463
|
-
reverse_proxy http://${source}
|
|
463
|
+
reverse_proxy http://${source} {
|
|
464
|
+
health_uri /
|
|
465
|
+
health_interval 2s
|
|
466
|
+
health_timeout 5s
|
|
467
|
+
fail_duration 2s
|
|
468
|
+
unhealthy_status 502 503 504 404
|
|
469
|
+
lb_try_duration 3s
|
|
470
|
+
lb_try_interval 300ms
|
|
471
|
+
|
|
472
|
+
@error status 502 503 504 404
|
|
473
|
+
handle_response @error {
|
|
474
|
+
respond * 503 {
|
|
475
|
+
body "Service Unavailable"
|
|
476
|
+
close
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
464
480
|
}
|
|
465
481
|
|
|
466
482
|
`;
|
|
@@ -527,14 +543,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
527
543
|
this._caddyChild.on("error", (err) => {
|
|
528
544
|
return reject(err);
|
|
529
545
|
});
|
|
530
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
546
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
531
547
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
532
548
|
for (const line of lines) {
|
|
533
549
|
showCaddyLog && line && console.info(line);
|
|
534
550
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
535
|
-
|
|
551
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
552
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
553
|
+
|
|
554
|
+
${line}
|
|
555
|
+
`);
|
|
556
|
+
await this.baseCleanup();
|
|
557
|
+
import_node_process4.default.exit();
|
|
558
|
+
} else {
|
|
559
|
+
consola.error(`${line}
|
|
536
560
|
`);
|
|
537
|
-
|
|
561
|
+
return reject(line);
|
|
562
|
+
}
|
|
538
563
|
}
|
|
539
564
|
if (line.includes("config file changed"))
|
|
540
565
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/rollup.js
CHANGED
package/dist/rspack.cjs
CHANGED
|
@@ -459,7 +459,23 @@ var CaddyInstant = class {
|
|
|
459
459
|
this.caddyfile = `${this.caddyfile}
|
|
460
460
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
461
461
|
${https ? "tls internal" : ""}
|
|
462
|
-
reverse_proxy http://${source}
|
|
462
|
+
reverse_proxy http://${source} {
|
|
463
|
+
health_uri /
|
|
464
|
+
health_interval 2s
|
|
465
|
+
health_timeout 5s
|
|
466
|
+
fail_duration 2s
|
|
467
|
+
unhealthy_status 502 503 504 404
|
|
468
|
+
lb_try_duration 3s
|
|
469
|
+
lb_try_interval 300ms
|
|
470
|
+
|
|
471
|
+
@error status 502 503 504 404
|
|
472
|
+
handle_response @error {
|
|
473
|
+
respond * 503 {
|
|
474
|
+
body "Service Unavailable"
|
|
475
|
+
close
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
463
479
|
}
|
|
464
480
|
|
|
465
481
|
`;
|
|
@@ -526,14 +542,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
526
542
|
this._caddyChild.on("error", (err) => {
|
|
527
543
|
return reject(err);
|
|
528
544
|
});
|
|
529
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
545
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
530
546
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
531
547
|
for (const line of lines) {
|
|
532
548
|
showCaddyLog && line && console.info(line);
|
|
533
549
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
534
|
-
|
|
550
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
551
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
552
|
+
|
|
553
|
+
${line}
|
|
554
|
+
`);
|
|
555
|
+
await this.baseCleanup();
|
|
556
|
+
import_node_process4.default.exit();
|
|
557
|
+
} else {
|
|
558
|
+
consola.error(`${line}
|
|
535
559
|
`);
|
|
536
|
-
|
|
560
|
+
return reject(line);
|
|
561
|
+
}
|
|
537
562
|
}
|
|
538
563
|
if (line.includes("config file changed"))
|
|
539
564
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/rspack.js
CHANGED
package/dist/utils.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as consola_dist_core from 'consola/dist/core';
|
|
2
2
|
|
|
3
|
-
declare const consola:
|
|
3
|
+
declare const consola: consola_dist_core.ConsolaInstance;
|
|
4
4
|
declare function chmodRecursive(_path: string, mode: number): Promise<void>;
|
|
5
5
|
declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
6
6
|
declare function isAdmin(): boolean | undefined;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as consola_dist_core from 'consola/dist/core';
|
|
2
2
|
|
|
3
|
-
declare const consola:
|
|
3
|
+
declare const consola: consola_dist_core.ConsolaInstance;
|
|
4
4
|
declare function chmodRecursive(_path: string, mode: number): Promise<void>;
|
|
5
5
|
declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
6
6
|
declare function isAdmin(): boolean | undefined;
|
package/dist/vite.cjs
CHANGED
|
@@ -460,7 +460,23 @@ var CaddyInstant = class {
|
|
|
460
460
|
this.caddyfile = `${this.caddyfile}
|
|
461
461
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
462
462
|
${https ? "tls internal" : ""}
|
|
463
|
-
reverse_proxy http://${source}
|
|
463
|
+
reverse_proxy http://${source} {
|
|
464
|
+
health_uri /
|
|
465
|
+
health_interval 2s
|
|
466
|
+
health_timeout 5s
|
|
467
|
+
fail_duration 2s
|
|
468
|
+
unhealthy_status 502 503 504 404
|
|
469
|
+
lb_try_duration 3s
|
|
470
|
+
lb_try_interval 300ms
|
|
471
|
+
|
|
472
|
+
@error status 502 503 504 404
|
|
473
|
+
handle_response @error {
|
|
474
|
+
respond * 503 {
|
|
475
|
+
body "Service Unavailable"
|
|
476
|
+
close
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
464
480
|
}
|
|
465
481
|
|
|
466
482
|
`;
|
|
@@ -527,14 +543,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
527
543
|
this._caddyChild.on("error", (err) => {
|
|
528
544
|
return reject(err);
|
|
529
545
|
});
|
|
530
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
546
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
531
547
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
532
548
|
for (const line of lines) {
|
|
533
549
|
showCaddyLog && line && console.info(line);
|
|
534
550
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
535
|
-
|
|
551
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
552
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
553
|
+
|
|
554
|
+
${line}
|
|
555
|
+
`);
|
|
556
|
+
await this.baseCleanup();
|
|
557
|
+
import_node_process4.default.exit();
|
|
558
|
+
} else {
|
|
559
|
+
consola.error(`${line}
|
|
536
560
|
`);
|
|
537
|
-
|
|
561
|
+
return reject(line);
|
|
562
|
+
}
|
|
538
563
|
}
|
|
539
564
|
if (line.includes("config file changed"))
|
|
540
565
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -460,7 +460,23 @@ var CaddyInstant = class {
|
|
|
460
460
|
this.caddyfile = `${this.caddyfile}
|
|
461
461
|
${target.split(":")[0]}${https ? "" : ":80"} {
|
|
462
462
|
${https ? "tls internal" : ""}
|
|
463
|
-
reverse_proxy http://${source}
|
|
463
|
+
reverse_proxy http://${source} {
|
|
464
|
+
health_uri /
|
|
465
|
+
health_interval 2s
|
|
466
|
+
health_timeout 5s
|
|
467
|
+
fail_duration 2s
|
|
468
|
+
unhealthy_status 502 503 504 404
|
|
469
|
+
lb_try_duration 3s
|
|
470
|
+
lb_try_interval 300ms
|
|
471
|
+
|
|
472
|
+
@error status 502 503 504 404
|
|
473
|
+
handle_response @error {
|
|
474
|
+
respond * 503 {
|
|
475
|
+
body "Service Unavailable"
|
|
476
|
+
close
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
464
480
|
}
|
|
465
481
|
|
|
466
482
|
`;
|
|
@@ -527,14 +543,23 @@ ${target.split(":")[0]}${https ? "" : ":80"} {
|
|
|
527
543
|
this._caddyChild.on("error", (err) => {
|
|
528
544
|
return reject(err);
|
|
529
545
|
});
|
|
530
|
-
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", (data) => {
|
|
546
|
+
(_a = this._caddyChild.stderr) == null ? void 0 : _a.on("data", async (data) => {
|
|
531
547
|
const lines = data.toString().split("\n").map((line) => line.trim());
|
|
532
548
|
for (const line of lines) {
|
|
533
549
|
showCaddyLog && line && console.info(line);
|
|
534
550
|
if (line.includes("Error:") || line && JSON.parse(line).level === "error") {
|
|
535
|
-
|
|
551
|
+
if (line.includes("parsing caddyfile tokens")) {
|
|
552
|
+
consola.error("Caddyfile syntax error, please contact the author:\n", `${this.caddyfile}
|
|
553
|
+
|
|
554
|
+
${line}
|
|
555
|
+
`);
|
|
556
|
+
await this.baseCleanup();
|
|
557
|
+
import_node_process4.default.exit();
|
|
558
|
+
} else {
|
|
559
|
+
consola.error(`${line}
|
|
536
560
|
`);
|
|
537
|
-
|
|
561
|
+
return reject(line);
|
|
562
|
+
}
|
|
538
563
|
}
|
|
539
564
|
if (line.includes("config file changed"))
|
|
540
565
|
consola.success("Detect added a new reverse proxy config, restarted.\n");
|
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
package/src/caddy/index.ts
CHANGED
|
@@ -192,7 +192,23 @@ export class CaddyInstant {
|
|
|
192
192
|
this.caddyfile = `${this.caddyfile}
|
|
193
193
|
${target.split(':')[0]}${https ? '' : ':80'} {
|
|
194
194
|
${https ? 'tls internal' : ''}
|
|
195
|
-
reverse_proxy http://${source}
|
|
195
|
+
reverse_proxy http://${source} {
|
|
196
|
+
health_uri /
|
|
197
|
+
health_interval 2s
|
|
198
|
+
health_timeout 5s
|
|
199
|
+
fail_duration 2s
|
|
200
|
+
unhealthy_status 502 503 504 404
|
|
201
|
+
lb_try_duration 3s
|
|
202
|
+
lb_try_interval 300ms
|
|
203
|
+
|
|
204
|
+
@error status 502 503 504 404
|
|
205
|
+
handle_response @error {
|
|
206
|
+
respond * 503 {
|
|
207
|
+
body "Service Unavailable"
|
|
208
|
+
close
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
`
|
|
@@ -277,16 +293,23 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
|
|
|
277
293
|
return reject(err)
|
|
278
294
|
})
|
|
279
295
|
|
|
280
|
-
this._caddyChild!.stderr?.on('data', (data) => {
|
|
296
|
+
this._caddyChild!.stderr?.on('data', async (data) => {
|
|
281
297
|
const lines = (data.toString() as string).split('\n').map(line => line.trim())
|
|
282
298
|
for (const line of lines) {
|
|
283
299
|
// caddy log
|
|
284
300
|
// eslint-disable-next-line no-console
|
|
285
301
|
showCaddyLog && line && console.info(line)
|
|
286
302
|
if (line.includes('Error:') || (line && JSON.parse(line).level === 'error')) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
303
|
+
if (line.includes('parsing caddyfile tokens')) {
|
|
304
|
+
consola.error('Caddyfile syntax error, please contact the author:\n', `${this.caddyfile}\n\n${line}\n`)
|
|
305
|
+
await this.baseCleanup()
|
|
306
|
+
process.exit()
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
consola.error(`${line}\n`)
|
|
310
|
+
// child.kill()
|
|
311
|
+
return reject(line)
|
|
312
|
+
}
|
|
290
313
|
}
|
|
291
314
|
if (line.includes('config file changed'))
|
|
292
315
|
consola.success('Detect added a new reverse proxy config, restarted.\n')
|