Forums

RedirectWebApp yields Error code: SSL_ERROR_BAD_CERT_DOMAIN

I have a default domain <username>.pythonanywhere.com, and I've purchased an addition web app to run the script found at https://help.pythonanywhere.com/pages/RedirectWebApp so that all traffic is redirected to www.<customdomain>.

I've added Force HTTPS certs to both domains. And also tried adding HTTPS to the custom domain but because www.<customdomain> is not like *.pythonanywhere, there is a certificate error.

Error code: SSL_ERROR_BAD_CERT_DOMAIN.

Unable to communicate securely with peer: requested domain name does not match the servers certificate.

This server could not prove that it is `www.<custom_domain>`; its security certificate is from *.pythonanywhere.com. This may be caused by a misconfiguration or an attacker intercepting your connection.

I expected this issue to not occur since it is a PythonAnywhere solution.

The issue is that, while I set Force HTTPS, I had not selected the Auto-update Let's Encrypt option.

I will leave this issue up in case someone does the same thing in the future.

Thanks for sharing @communitypediatricsYOW -- just as an addition to your solution, here's a help page on setting up auto-renewing cert on PA.