Failed to load resource: net::ERR_CONNECTION_REFUSED

I have been struggling to fix this issue.

I am running a python server with some services at http://localhost:8000 (with CORS setup to allow localhost calls)
and a Vue client at http://localhost:3000. The same setup is working in my local without any issues.

But when I run in Gitpod, As I launch my client and open it in browser, the response from the server is not being loaded. The request is going to the server but at the client I am getting the following error:

I have tried all scenarios and checked if it is CORS issue, but looks like it is not. Any help is appreciated.

Finally able to fix it by using the env variables and use the ROOT_URL instead of localhost.
export ROOT_URL=$(gp url 8000)