It sounds like an SNI (Server Name Indication) issue, where the self-hosted gateway isn't presenting the correct certificate for my_custom_domain.com.br over HTTPS, even though other connections work.
Here’s a focused approach:
Azure Portal: Check Hostname & Certificate:
Go to APIM > Gateways > [Your Self-Hosted Gateway] > Hostnames.
Ensure my_custom_domain.com.br is listed and your wildcard certificate (*.my_custom_domain.com.br) is explicitly selected and saved for this hostname. This is the most common fix.
Gateway Logs for Errors:
When you attempt https://my_custom_domain.com.br, immediately check the gateway container logs:
<span style="font-size:inherit">docker logs <your_gateway_container_name_or_id></span>
Look for TLS handshake, certificate, or SNI errors.
Test Certificate with openssl s_client:
This tool reveals what certificate the gateway presents for your domain:
<span style="font-size:inherit">openssl s_client -connect my_custom_domain.com.br:443 -servername my_custom_domain.com.br</span>
Verify the correct certificate is shown. Note any errors. The error "Client network socket disconnected..." suggests the gateway might be closing the connection if it can't find a matching cert for the SNI.
Gateway Configuration Sync & Restart:
Ensure the gateway can sync with Azure (outbound port 443 to *.configuration.azure-api.net).
After verifying portal settings, a gateway restart (docker restart <container_id>) can help apply changes.
Reference Docs:
Configure custom domain for self-hosted gateway
Please let me know incase of further queries, I would be happy to assist you.