Question: I'm having a problem with my program and it's that, right now, I'm creating a JFrame with some buttons in it (I'm developing in NetBeans), and, with some of them, it appears a problem that I don't know why it is.
[enter image description here](https://i.stack.imgur.com/H7vMK.png)

Answer: 
> 
> I can use the DNS of ALB (xxxx.us-east-1.elb.amazonaws.com) 
> 
> 
> 

That isn't how this is designed to work. You need to point `test.example.com` to the ELB in DNS, and then:

```
url = "https://test.example.com/prod/testapi"

```
Clearly, you call xxxx.us-east-1.elb.amazonaws.com which is set up with a certificate for test.example.com. Despite the certificate may be valid it does not match the URL you are calling which means that the certificate is NOT valid for THIS call. I think you also must set a custom domain for the API gateway. <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html>

Edit: thanks for the comment. I am not sure how I read "elb" as an api gateway. My fault. Still the DNS for the ELB has to match the one in the certificat. You can create a CNAME from your domain to the ELB domain. This should work (at least this is how we do that).