Custom domain problem

I own a bare (i.e., mydomain.com) Google domain. This domain directs to my Anvil app without problem, using an A record pointing to 52.56.203.177. However, when I attempt to set up www.mydomain.com by using a synthetic record to redirect www.mydomain.com to mydomain.com, I encounter the following error:

“This site can’t be reached
www.mydomain.com unexpectedly closed the connection.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_CLOSED”

What am I doing wrong? Do I need to enter both mydomain.com and www.mydomain.com in the “Publish App” dialogue box using a comma to separate them?

Hi Stephen,

For privacy, I’ve replaced all references to your actual domain with mydomain.com below - but I did test with your actual domain name.

It looks like the server that’s performing the redirect doesn’t support HTTPS.

When I curl http://www.mydomain.com, I correctly get redirected to http://mydomain.com.

$ curl http://www.mydomain.com/
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://mydomain.com/">here</A>.
</BODY></HTML>

When I curl https://www.mydomain.com, I get an SSL error:

$ curl https://www.mydomain.com/
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to www.mydomain.com:443

(In a web browser, the user is always directed to https:// because Anvil uses HSTS as part of our security model.)

I think it should be possible to configure the Synthetic Record to work over HTTPS, see this Stack Exchange question.

Alternatively, we can poke something manually our end to allow you to set up an A record for www.mydomain.com. This is something we’re happy to do for anybody.

1 Like

Thanks, Shaun, you nailed the problem. I went into Google Domains and set up secure SSL in the Synthetic Record–it worked!

2 Likes