Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Hostname/IP doesn't match certificate's altnames | Node & Nginx

Writer Mia Lopez

Among several subdomains, I have node servers running on different ports. I have a subdomain called alexa-service.healform.de, which runs a node server that should execute some functions and requests. One function of this is a GET query of data provided by another subdomain, hosted on my server too - oauth2.healform.de. If I let this function run, I get the following error message in the terminal and that is also the curious part:

Error message:

Hostname / IP does not match certificate's altnames: "Host: localhost." Is not in the cert's altnames: DNS: ampinbaunatal.de, DNS: "

When I saw that, I thought I was asking AskUbuntu rather than Stack. The domains ampinbaunatal.de and are also hosted on my server and also have a valid SSL certificate issued by Let's Encrypt. But why does the function of oauth2.healform.de differ on ampinbaunatal.de? The domains have nothing to do with the function.

When I call the endpoint of the data, the function should retrieve, with Postman, I get a correct response. But as soon as I run the API query in localhost via the node server (I'm on Ubuntu Server 18.04 btw.), it somehow switches to the other domain and I get this error message.

Does anyone have an idea what's wrong with the certificates? Both have valid SSL certificates. And why does he accidentally switch to the ampinbaunatal.de domain?


Nginx config for both servers:

server { server_name oauth2.healform.de; location / { proxy_pass proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen 443 ssl; # managed by Certbot ssl_certificate /path/to/fullchain.pem; # managed by Certbot ssl_certificate_key /path/to/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server { server_name alexa-services.healform.de; location / { proxy_pass proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen 443 ssl; # managed by Certbot ssl_certificate /path/to/fullchain.pem; # managed by Certbot ssl_certificate_key /path/to/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

The function which gets executed due Alexa request:

function getNextAppointment() { return new Promise((resolve, reject) => { var options = { url: ' path: '/api/userData', method: 'GET', tls: { rejectUnauthorized: false }, rejectUnauthorized: false, headers: { Authorization: 'Bearer < Token >', 'Content-Type': 'application/json', Accept: 'application/json' } }; const request = https.request(options, response => { response.setEncoding('utf8'); let returnData = ''; response.on('data', chunk => { returnData += chunk; }); response.on('end', () => { resolve(JSON.parse(returnData)); }); response.on('error', error => { reject(error); }); }); request.end(); });
}
7 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy