Running Node-RED behind reverse proxy that does not point to subdomain (for example nodered1.server.com) but to specific path like server.com/nodered1 causes auth issues (and maybe more).
Before you go any further down this route even once you get authentication to work for a single instance, you need to know that you can't run more than one instance this way. e.g. www.example.com/nodered1 and www.example.com/nodered2 because the editor currently stores it's access token in browser local storage which is only scoped to the hostname, not the hostname + path.
The solution to the first problem probably to include a rewrite option in your reverse proxy settings. Can you post what your proxy config and is it Nginx, Apache or Traefik?
There is at least 1 setting in Node-RED that tells it to trust the proxy, you may need to do that.
Otherwise, use your proxy to do authentication, not node-red. This is likely to be more flexible, and powerful anyway and creates a nice separation of concerns between node-red and the proxy.