[Bug] Hardcoded backend API URL in vite.config.ts breaks dev proxy on default port 8080 and custom environment
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript, vite
Research direction
Start with config-ui/vite.config.ts lines 40–44 and compare the /api proxy with the configurable /grafana proxy below it. Check the default backend port in .env.example, docker-compose-dev.yml, and AGENTS.md, then run config-ui with yarn dev against the default and an overridden environment. Done means /api requests reach the configured backend without editing the tracked Vite config.
Written by the indexing model from the issue text.
Description
Search before asking
- I had searched in the issues 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
- Start DevLake backend on the default port (http://localhost:8080).
- Run config-ui with yarn dev (runs on http://localhost:4000).
- Open http://localhost:4000/ in the browser.
- 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?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Go
- Stars
- 3.1k
- Forks
- 812
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 46
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/devlake
-
Stale type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
type/bug
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
apache/devlake#9142 · 2 comments · 1 reaction · 1 assignee ·
Similar issues
-
Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
milvus-io/birdwatcher#545 ·
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/prow#953 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
caddyserver/caddy#8046 ·