mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-17 06:54:34 +00:00
Fix for SSL certificate error #2011
- Keepalive, User Agent + Accept headers - Catch added for failed JSON parsing - More accurate errors displayed to user
This commit is contained in:
@ -1164,7 +1164,10 @@ const internalCertificate = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Content-Length': Buffer.byteLength(formBody)
|
||||
'Content-Length': Buffer.byteLength(formBody),
|
||||
'Connection': 'keep-alive',
|
||||
'User-Agent': 'Nginx Proxy Manager',
|
||||
'Accept': '*/*'
|
||||
}
|
||||
};
|
||||
|
||||
@ -1175,12 +1178,16 @@ const internalCertificate = {
|
||||
|
||||
res.on('data', (chunk) => responseBody = responseBody + chunk);
|
||||
res.on('end', function () {
|
||||
const parsedBody = JSON.parse(responseBody + '');
|
||||
if (res.statusCode !== 200) {
|
||||
try {
|
||||
const parsedBody = JSON.parse(responseBody + '');
|
||||
resolve(parsedBody);
|
||||
}
|
||||
catch {
|
||||
logger.warn("Error");
|
||||
logger.warn(`Status Code: ${res.statusCode}`);
|
||||
logger.warn(`Failed to test HTTP challenge for domain ${domain}`, res);
|
||||
resolve(undefined);
|
||||
}
|
||||
resolve(parsedBody);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user