Thundercloud12 opened a new issue, #9154:
URL: https://github.com/apache/devlake/issues/9154

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   n config-ui/vite.config.ts, the /api dev proxy target is hardcoded directly 
to http://localhost:8081/:
   
   // config-ui/vite.config.ts
   proxy: {
     '/api': {
       target: 'http://localhost:8081/',
       changeOrigin: true,
       rewrite: (path) => path.replace(/^\/api\//, ''),
     },
     // ...
   }
   
   This causes two problems:
   
   Port mismatch with the default backend
   
   The DevLake backend defaults to port 8080, as defined in .env.example, 
docker-compose-dev.yml, and AGENTS.md.
   
   Anyone starting the backend on its default port and launching config-ui gets 
ECONNREFUSED proxy errors unless they modify vite.config.ts or change their 
backend port.
   
   Inflexible development/container setup
   
   When developing inside Dev Containers, Docker, or with a remote backend 
host, the API target cannot be overridden via environment variables without 
modifying the tracked vite.config.ts file.
   
   In contrast, the /grafana proxy directly below it in the same file already 
supports dynamic configuration via:
   
   VITE_GRAFANA_URL
   VITE_GRAFANA_PORT
   VITE_GRAFANA_HOST
   VITE_GRAFANA_PROTOCOL
   
   These variables were introduced in PR #8645.
   
   ### What do you expect to happen
   
   The /api proxy should:
   
   Default to the DevLake backend's default port (8080).
   Allow the backend host, protocol, and port to be overridden through 
environment variables.
   Avoid requiring developers to modify the tracked vite.config.ts file for 
different development or container environments.
   
   ### How to reproduce
   
    1. Start DevLake backend on the default port (http://localhost:8080).
     2. Run config-ui with yarn dev (runs on http://localhost:4000).
     3. Open http://localhost:4000/ in the browser.
     4. Any API request directed to /api/... fails with ECONNREFUSED because 
Vite
     forwards requests to http://localhost:8081/.
   
   ### Anything else
   
   • File: config-ui/vite.config.ts (lines 40–44)
    • Consistent with how config-ui/nginx.conf and config-ui/nginx.sh
     dynamically use ${DEVLAKE_ENDPOINT} in production.
   I found this while developing grafana_irm plugin 
   
   ### Version
   
   main (commit 05dad99c8)
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to