Skip to content

Commit 580e16a

Browse files
dawidclaude
andcommitted
Fix Ingress routing for dashboard API endpoints
- Change absolute URLs (/api/*) to relative URLs (./api/*) - This ensures API calls work correctly through Home Assistant Ingress - Previous calls were going to HA root instead of addon context - Fix both HTML links and JavaScript fetch calls 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 304f5d5 commit 580e16a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

dashboard/api/server.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,20 @@ function getDashboardHTML() {
4242
<p>MCP Dashboard API is running!</p>
4343
<h2>Available MCP Endpoints:</h2>
4444
<ul>
45-
<li><a href="/api/health">/api/health</a> - MCP system health</li>
46-
<li><a href="/api/metrics">/api/metrics</a> - MCP system metrics</li>
47-
<li><a href="/api/cache">/api/cache</a> - MCP cache statistics</li>
48-
<li><a href="/api/logs">/api/logs</a> - MCP server logs</li>
49-
<li><a href="/api/dashboard">/api/dashboard</a> - Complete MCP dashboard data</li>
45+
<li><a href="./api/health">api/health</a> - MCP system health</li>
46+
<li><a href="./api/metrics">api/metrics</a> - MCP system metrics</li>
47+
<li><a href="./api/cache">api/cache</a> - MCP cache statistics</li>
48+
<li><a href="./api/logs">api/logs</a> - MCP server logs</li>
49+
<li><a href="./api/dashboard">api/dashboard</a> - Complete MCP dashboard data</li>
5050
</ul>
5151
<p>Status: <span id="status">Checking...</span></p>
5252
<script>
53-
fetch('/api/health')
53+
// Use relative URL that works with Ingress
54+
const apiUrl = window.location.pathname.endsWith('/') ? 'api/health' : './api/health';
55+
fetch(apiUrl)
5456
.then(response => {
5557
console.log('Response status:', response.status);
56-
console.log('Response headers:', response.headers);
58+
console.log('Response URL:', response.url);
5759
return response.text();
5860
})
5961
.then(text => {

0 commit comments

Comments
 (0)