front-check: insecureHTTPParser pour le check HTTP (le nginx prod envoie un header que llhttp refuse, curl le tolere)
Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -48,7 +48,8 @@ function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
|
|||||||
function httpStatus(url, redirects = 3) {
|
function httpStatus(url, redirects = 3) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const mod = url.startsWith('https') ? require('https') : require('http');
|
const mod = url.startsWith('https') ? require('https') : require('http');
|
||||||
const req = mod.get(url, { timeout: 15000 }, (res) => {
|
// insecureHTTPParser: le nginx prod envoie un header que le parser strict (llhttp) de node refuse ; curl le tolère, on fait pareil
|
||||||
|
const req = mod.get(url, { timeout: 15000, insecureHTTPParser: true }, (res) => {
|
||||||
if ([301, 302, 303, 307, 308].includes(res.statusCode) && res.headers.location && redirects > 0) {
|
if ([301, 302, 303, 307, 308].includes(res.statusCode) && res.headers.location && redirects > 0) {
|
||||||
res.resume();
|
res.resume();
|
||||||
const next = new URL(res.headers.location, url).href;
|
const next = new URL(res.headers.location, url).href;
|
||||||
|
|||||||
Reference in New Issue
Block a user