Skip to content

fix: restore /public/ console in 2.0.0 (regression from 1.15.2)#1662

Open
stochastic-sisyphus wants to merge 1 commit into
Portkey-AI:2.0.0from
stochastic-sisyphus:fix/restore-public-console
Open

fix: restore /public/ console in 2.0.0 (regression from 1.15.2)#1662
stochastic-sisyphus wants to merge 1 commit into
Portkey-AI:2.0.0from
stochastic-sisyphus:fix/restore-public-console

Conversation

@stochastic-sisyphus
Copy link
Copy Markdown

Summary

  • Restores src/public/index.html (verbatim copy from v1.15.2)
  • Re-adds /public/, /public/logs, and /public redirect handlers in src/start-server.ts
  • Adds cp -r src/public build/public to the Dockerfile build step so the asset lands in the image

Why

v1.15.2 shipped a self-contained ~75 KB HTML console at build/public/index.html, served at /public/. 2.0.0 silently removed it in three places:

  1. src/public/index.html deleted from source.
  2. src/start-server.ts route handlers removed (the v1.15.2 setupStaticServing() block).
  3. rollup.config.js rollup-plugin-copy step removed.

Linux Docker builds of 2.0.0 therefore produce a console-less image, regressing the OSS deployment story vs 1.15.2. Self-hosters lose the only built-in UI shipped with the gateway.

Approach

The minimal fix is one-line in the Dockerfile (cp -r src/public build/public) rather than reintroducing the rollup-plugin-copy devDep. Same artifact in the image, fewer dependencies.

Test plan

  • docker build -t portkeyai/gateway:2.0.0 . succeeds on Linux.
  • docker run portkeyai/gateway:2.0.0 starts; curl http://localhost:8787/public/ returns HTTP 200 with the 75,930-byte console (<title>Portkey AI Gateway</title>).
  • /v1/chat/completions inference unaffected.

Companion PRs: #1660 (realtimeLLMEventParser case-rename), #1661 (akto/zscaler plugin path move) — together with this one, the 2.0.0 branch builds cleanly on Linux Docker.

v1.15.2 shipped a self-contained ~75 KB HTML console at
build/public/index.html, served by the gateway at /public/.
2.0.0 silently dropped it in three places:

  1. src/public/index.html — deleted from source
  2. src/start-server.ts — /public/ route handlers removed
  3. rollup.config.js — rollup-plugin-copy step removed

Linux Docker builds of 2.0.0 therefore produce an image with no
gateway console, regressing the OSS deployment story vs 1.15.2.

Restore by:
  - Re-adding src/public/index.html (copied verbatim from v1.15.2)
  - Re-adding the three app.get('/public[/logs]'...) handlers in
    src/start-server.ts
  - Adding `cp -r src/public build/public` to the Dockerfile build
    step (avoids reintroducing the rollup-plugin-copy devDep —
    smaller change than restoring the rollup plugin)

Verified: rebuilt image, /public/ returns 200 with the 75 KB
console (Content-Type: text/html, <title>Portkey AI Gateway</title>).
/v1/chat/completions inference unaffected.
Copilot AI review requested due to automatic review settings May 20, 2026 05:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR restores a lightweight /public/ console by serving a bundled index.html from the server and ensuring the static assets are shipped into the Docker image.

Changes:

  • Add server routes for /public/, /public, and /public/logs that render a bundled index.html.
  • Add a large src/public/index.html console page (Gateway + Logs UI).
  • Update Docker build to copy src/public into the build output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 13 comments.

File Description
src/start-server.ts Adds runtime loading of public/index.html and registers /public/* routes (with a fallback if missing).
src/public/index.html Introduces the restored console UI (styles + client-side logic + logs via SSE).
Dockerfile Copies src/public into build/public as part of the image build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile

# Build the application and clean up
RUN npm run build \
&& cp -r src/public build/public \
Comment thread src/start-server.ts
Comment on lines +44 to +45
} catch {
console.warn('Console asset missing — /public/ disabled');
Comment thread src/public/index.html
<!-- End Google Tag Manager -->

<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"> -->
<link rel="stylesheet" href="https://unpkg.com/highlightjs@9.16.2/styles/atom-one-light.css">
Comment thread src/public/index.html
Comment on lines +856 to +863
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KX3PMNVR');</script>
<!-- End Google Tag Manager -->

Comment thread src/public/index.html
</div> -->
</div>

<script src="https://unpkg.com/lucide@latest"></script>
Comment thread src/public/index.html
Comment on lines +1983 to +1994
tr.innerHTML = `
<td class="log-time">${time}</td>
<td class="log-method"><span class="log-method-value">${method}</span></td>
<td class="log-endpoint">${endpoint}</td>
<td class="log-status"><span class="${status>=200 && status<300 ? 'success' : 'error'}">${status}</span></td>
<td class="log-duration">${duration}ms</td>
<td><button class="btn-view-details">View Details</button></td>
`;

const viewDetailsBtn = tr.querySelector('.btn-view-details');
viewDetailsBtn.addEventListener('click', () => showLogDetails(time, method, endpoint, status, duration, requestOptions));

Comment thread src/public/index.html
Comment on lines +2028 to +2037
logDetailsContent.innerHTML = `
<h3>Request Details</h3>
<p><strong>Time:</strong> ${time}</p>
<p><strong>Method:</strong> ${method}</p>
<p><strong>Endpoint:</strong> ${endpoint}</p>
<p><strong>Status:</strong> ${status}</p>
<p><strong>Duration:</strong> ${duration}ms</p>
<p><strong>Request:</strong> <pre>${JSON.stringify(requestOptions[0].requestParams, null, 2)}</pre></p>
<p><strong>Response:</strong> <pre>${JSON.stringify(requestOptions[0].response, null, 2)}</pre></p>
`;
Comment thread src/public/index.html
Comment on lines +1954 to +1957
logSource.onerror = (error) => {
console.error('SSE error (logs):', error);
reconnectLogSource();
};
Comment thread src/public/index.html
Comment on lines +577 to +589
.main-content {
max-width: 1200px;
margin: 1rem auto;
padding: 0 1rem;
}

/* Main content styles */
.main-content {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
transition: margin-bottom 0.3s ease;
}
Comment thread src/public/index.html
incrementLogCounter();

setTimeout(() => {
tr.className = '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants