Search code examples
javaherokuspring-bootssl-certificatenetflix-zuul

Heroku cert for free dyno does not match it's ulr


I'm building an application in microservices architecture. I'm using Netflix's zuul, eureka and microservice based on SpringApplication. Whole project is to be deployed on Heroku using free account. Because of this each service is a separate application and is served by Heroku via https to the public.

For now I've managed to deploy eureka, then deploy microservice that is registering in eureka, then deploy zuul that registers in eureka and gets the routes from eureka. Now I'm facing problem with Heroku certificates. When I send request directly to microservice, then I get a response. When I send a request via zuul, then I get an 500 error. Looking through zuul logs I found:

Caused by: javax.net.ssl.SSLPeerUnverifiedException: Certificate for <ffa57931-eab7-425c-ab80-0ec6fe669a9d.prvt.dyno.rt.heroku.com> doesn't match any of the subject alternative names: [*.herokuapp.com, herokuapp.com]

I couldn't find a solution for configuring ribbon to accept all certs. So the question is how can I workaround this problem without using custom ssl certificates?


Solution

  • Ok, I found a problem. When using eureka REST API I've specified:

    "hostname": "localhost".
    

    This is the reason zuul was trying to route traffic to
    ffa57931-eab7-425c-ab80-0ec6fe669a9d.prvt.dyno.rt.heroku.com.

    Instead, I should use:

    "hostname": <heroku_appname>.herokuapp.com
    

    Thanks everyone for comments. Hope it will help is someone finds himself in same trouble.