artemy-osipov / thrift-rest-bridge-ui

MIT License
3 stars 0 forks source link

thrift-rest-bridge-ui doesn't work #6

Closed qwez closed 2 months ago

qwez commented 2 months ago

Launching UI:

user ~ % export API_URL=http://my-bridge-server
user ~ % export BASE_HREF=/thrift-rest-bridge-ui
user ~ % docker run --rm -p 80:80 -e API_URL -e BASE_HREF ghcr.io/artemy-osipov/thrift-rest-bridge-ui:0.5.0
{"level":"info","ts":1719498699.667277,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"info","ts":1719498699.6695647,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"warn","ts":1719498699.669669,"logger":"http.auto_https","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
{"level":"info","ts":1719498699.6697798,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1719498699.6699555,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1719498699.6699893,"msg":"serving initial configuration"}
{"level":"info","ts":1719498699.670009,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
{"level":"info","ts":1719498699.6700315,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1719498699.6700847,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000475700"}

http://localhost:80/thrift-rest-bridge-ui shows Page not found (404) http://localhost:80 shows white page, in logs I can see requests to http://localhost/thrift-rest-bridge-ui/init.js, http://localhost/thrift-rest-bridge-ui/_app/immutable/entry/start.bb572467.js, etc with 404 status

artemy-osipov commented 2 months ago

BASE_HREF should be used with reverse proxy

nginx conf example:

server {
  location /thrift-rest-bridge-ui {
    proxy_pass http://bridge-ui/;
  }
}

PS BASE_HREF is now optional, so you can run UI with docker run --rm -p 80:80 -e API_URL ghcr.io/artemy-osipov/thrift-rest-bridge-ui:0.6.0 and open http://localhost:80

qwez commented 2 months ago

Yeah, it helped, thanks. But now I got CORS error, when UI requests http://localhost:8080/services UI is on localhost:80, Rest bridge on localhost:8080 Any chance to fix it, or I should use nginx or something like this?

qwez commented 2 months ago

It works with nginx. Thanks, issue can be resolved