Some times ago, I changed the default DNS used by my Mac wih the ones from cloudflare 1.1.1.1
.
On my way back to france, I couldn't reach the webpage to login with the free wifi provided by the train company.
To fix the problem, I connected to the free wifi with my phone, checked the DNS IP address from the wifi settings. Then, I added this IP address to my DNS (System Preferences > Network > DNS). Connecting to the url then worked like a charm!
Otherwise you can reset all your DNS parameter.