Wagtail login downgrades to http, gives error
I am setting up a new, local version of a Django Wagtail project (which I have had running locally before). I am able to see Pages in my browser, but when I try to login (on FF, Chrome, Safari-with-no-plugins) at https://mysite.test/admin/login/?next=/admin/ I get the error:
gaierror at /admin/login/
[Errno -2] Name or service not known
Request Method: POST
Request URL: http://mysite.test/admin/login/
Django Version: 5.0.3
Exception Type: gaierror
Exception Value:
[Errno -2] Name or service not known
Exception Location: /usr/lib/python3.10/socket.py, line 955, in getaddrinfo
Raised during: wagtail.admin.views.account.LoginView
Python Executable: /root/uv/.venv/bin/python
Python Version: 3.10.12
Python Path:
['/usr/srv/app',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/root/uv/.venv/lib/python3.10/site-packages',
'/root/uv/.venv/lib/python3.10/site-packages/setuptools/_vendor']
Server time: Thu, 03 Jul 2025 13:44:22 +0000
which includes the request URL http://mysite.test/admin/login/.
I don't have a VPN running and I can't identify anything else which might be causing trouble on the local network (though I can't discount this).
If I try https://127.0.0.1:5000/admin I get:
Secure Connection Failed
An error occurred during a connection to 127.0.0.1:5000. SSL received a record that exceeded the maximum permissible length.
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the web site owners to inform them of this problem.
What could be going wrong here?