Gateway error using ui

I’m trying to add some features in ChirpStack UI, but get an error trying to run in with nginx.

Dockerfile


FROM nginx:1.21-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d
RUN rm -rf /usr/share/nginx/html/*
COPY /ui/build /usr/share/nginx/html


nginx.conf


server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location /api.InternalService {
proxy_pass http://localhost:8080;
}
}


Error : POST http://localhost/api.InternalService/Settings “502 Bad Gateway”

That error means NGINX can’t proxy the request to the underlying service (http://localhost:8080).

So, how can I solve this problem. When I’m in dev, proxy works perfect, but when I run “yarn build” and put all code in nginx, nothing works. At the same time, localhost:8080 works.

So, I installed Envoy and now get this error:

"connect() failed (111: Connection refused) while connecting to upstream, client: 172.22.0.1, server: , request: “POST /api.InternalService/Settings HTTP/1.1”, upstream: “http://127.0.0.1:9000/api.InternalService/Settings”, host: “127.0.0.1”, referrer: “http://127.0.0.1/”.

Is that even possible to get working version of ui after edit and build?

I’m sorry, I can’t support you on the modifications you are making. However, the “official” ChirpStack releases are all built from source, if you make changes and follow the same build steps, then you should end up with a working ChirpStack version including your modifications.

You might try changing the proxy_pass directive to

proxy_pass http://127.0.0.1:8080;

For me that did the trick… Not sure what the issue with hostname resolution is, but my nginx would also come up with 502 (bad gateway) unless I restarted the nginx service manually using

sudo systemctl restart nginx