Search code examples
sslcertificatelets-encrypt

Lestencrypt: Invalid certificate chain because of port


I have app (backend part) running e.g. on: https://bla.com:8443. I created a certificate for it via letsencrypt for domain bla.com.

When I tried to receive payments (webhook) from www.stripe.com I end up with TLS error. After some investigation I figure out that problem is with invalid certificate chain for https://bla.com:8443 and if I would run it on https://bla.com:443 everything would be ok.

I can't change it to port 443 because on https://bla.com:443 is running frontend part of the app.

I thought about 2 solutions, but my technical knowledge is quite limited so I am not sure if its possible:

  1. create certificate for domain + port
  2. run frontend & backend part on same port: https://bla.com:443 and configure apache2 to forward all /backend-api/* to https://bla.com:8443/backend-api/*

My question is, is any of the proposals possible and more importantly is there any better solution which I am missing?

Thanks for any suggestions!


Solution

  • A certificate is not bound to a port. It is perfectly fine to use the same certificate on port 443 and 8443. But the servers on port 443 and 8443 have a different configuration. If it works on 443 but not on 8443 this is likely due to some error in the configuration on port 8443. The fix is thus to have the correct configuration and not to work around with a different certificate or somehow to reverse proxy it from port 443.

    Unfortunately details on how to exactly fix it cannot be given since the current configuration is not known.