HEADWAY_PUBLIC_URL always points to 127.0.0.1
Hello, after deploying the stack I am getting the following error no matter what I enter for public_url variable in .env
BaseMap.9427e3c8.js:4
GET http://127.0.0.1:8080/tileserver/data/default.json net::ERR_CONNECTION_REFUSED
I am running nginx as a reverse proxy. Tried to change the default public_url from http://localhost:8080 to https://mydomain.com but still getting the same error after recreating containers, seems like 127.0.0.1 is persistent.
Any thoughts?
Hi! What steps are you taking to deploy the stack?
earthly -P +build --area="turkey-latest" --countries="TR" cp .env.example .env (in my .env I changed HEADWAY_AREA to turkey-latest, HEADWAY_BBOX to correct coordinates, and left HEADWAY_PUBLIC_URL as default http://127.0.0.1:8080 since I am running Headway behind nginx) docker-compose up -d
In my nginx.conf file I have got the following to reverse proxy requests to headway:
location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme;
I'm not totally sure what's going on, so I'll just say some things you might already know in case they're helpful:
HEADWAY_PUBLIC_URL should be the URL that the user types into their browser to get to your site.
For example, for our headway deployment, HEADWAY_PUBLIC_URL=https://maps.earth
If you look in your network tab when loading maps.earth, you'll see a request corresponding to your reported failure: https://maps.earth/tileserver/data/default.json
When a user requests HEADWAY_PUBLIC_URL, e.g. curl https://maps.earth ultimately your nameserver and any load balancer / reverse proxy should direct that request to the "frontend" container, which will then proxy the request to the corresponding backend service (tiles, routing, etc.).
Thanks, this is really bizarre but once I changed HEADWAY_PUBLIC_URL to https://mydomain.com it worked! I think I was a bit confused by .env.example where the port was added to the URL. Thanks a lot! Next step is to find a way to keep the default position of the map in certain point (I am self-hosting only one region, not world map).
You can use this variable to set the default bounding box. https://github.com/headwaymaps/headway/blob/main/.env-example#L16 but IIRC the viewport is saved from visit to visit.
Thanks, it worked. Sorry, forgot to comment. Closing now.