In the case of Apache Server, you need to add
ProxyPreserveHost on
in your proxy configuration. In case of NGINX, you can need to addproxy_set_header Host $http_host;
in your configuration.
It is broken for IPv6 access: New CSRF check broken with raw IPv6 Host · Issue #45115 · grafana/grafana · GitHub