Getting "Blocking Cross Origin API request" while running jupyterhub with proxy

I am using jupyterhub==2.0.0 in python with configurable-http-proxy proxy in local.
The jupyterhub service is running at port 8180.
The port and api-port for configurable-http-proxy are 8100 and 8101.
While launching a notebook server, getting Blocking Cross Origin API request for api hub/api/users//server/progress.
It is is because the Referrer request header contains proxy port whereas Host header has hub port when request reaches hub service. But in browser both Referrer and Host header contains proxy port only.

jupyterhub logs:

hub.jupyterhub.localhost | [D 2024-02-03 06:02:40.193 JupyterHub base:279] Recording first activity for <User(<user_id> 1/1 running)>
hub.jupyterhub.localhost | [W 2024-02-03 06:02:40.195 JupyterHub base:76] Blocking Cross Origin API request. Referer: https://domain:8100/hub/spawn-pending/<user_id>?next=%2Fhub%2Fuser%2F<user_id>%2Fnotebooks%2FUntitled.ipynb, Host: domain:8180/hub/
hub.jupyterhub.localhost | [D 2024-02-03 06:02:40.196 JupyterHub scopes:488] Checking access via scope read:servers
hub.jupyterhub.localhost | [D 2024-02-03 06:02:40.196 JupyterHub scopes:383] No access to /hub/api/users/<user_id>/server/progress via read:servers
hub.jupyterhub.localhost | [W 2024-02-03 06:02:40.196 JupyterHub scopes:496] Not authorizing access to /hub/api/users/<user_id>/server/progress. Requires any
of [read:servers], not derived from scopes
hub.jupyterhub.localhost | [W 2024-02-03 06:02:40.196 JupyterHub web:1873] 403 GET /hub/api/users/<user_id>/server/progress ( Action is not authorized with current scopes; requires any of [read:servers]
hub.jupyterhub.localhost | [W 2024-02-03 06:02:40.197 JupyterHub log:189] 403 GET /hub/api/users/<user_id>/server/progress 7.50ms
jupyterhub.hackerearth.localhost | 06:02:40.197 [ConfigProxy] debug: Not recording activity for status 403 on /

How can we resolve this?

JupyterHub 4 no longer uses the Referer header to do these checks for reasons like this, but in general reverse proxies can be instructed to preserve Host headers, etc. (which has several benefits for accurate logging, etc.). You can check out our docs for an example, in particularly the proxy_set_header Host $host line for nginx or ProxyPreserveHost on in Apache.