How to get A record subdomain to keep the subdomain name rather than just redirect to the IP address?

I have an A record pointing to a Digital Ocean droplet server. It works well. The subdomain points to the specified IP address.

How can I keep the subdomain in the url?

Every time I go to api.mydomain.com (redirects) -> 192.168.2.2 which causes my SSL certificate to complain as the url and the registered name on the cert don’t match.

Is there a record I need to configure on Netlify’s or Digital Ocean’s DNS settings?

Hi,

The URL would only change if you’re changing it somehow. You haven’t provided a real domain or any other info so I can’t check. If you just have an A record setup and you use that to load a site, then that would just work. Can you provide the actual subdomain that’s not working properly?