Search code examples
node.jsssldnsibm-cloudbluemix-app-scan

SSL certificate propagation issue with custom domain on Bluemix app


I uploaded my SSL certificate in the section of my custom domain in the space of my organization. I linked the domain with my application and I have created the CNAME record in my DNS to my broken app xxxxx-gb.bluemix.net .eu.

enter image description here

When I try to reach my application through my domain custom, I served me the Bluemix certificate and not mine. enter image description here

I tried to add a proxy on my server (NodeJS) but the situation does not change.

 app.enable('trust proxy');
 app.use(function (req, res, next) {
        if (req.secure) {
                // request was via https, so do no special handling
                next();
        } else {
                // request was via http, so redirect to https
                res.redirect('https://' + req.headers.host + req.url);
        }
  });

How can I fix the problem ? I need my certificate, to call my API, from my mobile application, it is the certificate must necessarily be mine and then TRUSTED


Solution

  • You need to map the CNAME to the secure endpoint for the Bluemix region you are using, in your case it should be secure.eu-gb.bluemix.net.

    When receiving the request from your custom domain Bluemix will map it internally to your app.

    More details in the documentation link below:

    https://new-console.ng.bluemix.net/docs/manageapps/updapps.html#domain