CSRF error after login (on both local host or hosted server)

I installed a new instance of frappe (branch 15), and erpnext 15 (branch 15). After login, I keep getting “Invalid Request” (400). On a little investigation, I found that it’s CSRF token issue. If I add "ignore_csrf = true, in site_config.json, the error vanishes. The same is happening with a demo hosted server.
How to fix this issue? And which code is the common code for this error?

Adding some more info:

  1. installation done on Windows WSL2, Ubuntu-22.04
  2. remote installation done on linux ubuntu-22.04