Skip to content

[Bug]: Static assets return 404 when APP_ROOT_PATH is configured #865

@ESnark

Description

@ESnark

🐞 Bug Summary

Static assets (CSS, JS) fail to load with 404 errors when MCP Gateway is deployed behind a reverse proxy with a custom base path configured via APP_ROOT_PATH.


🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. Set environment variable APP_ROOT_PATH=/gateway (or any custom path)
  2. Access the Admin UI at https://example.com/gateway/admin
  3. Observe browser DevTools Network tab showing 404 errors for:
    • /static/admin.css (should be /gateway/static/admin.css)
    • /static/admin.js (should be /gateway/static/admin.js)

🤔 Expected Behavior

Static assets should be served from the correct path when APP_ROOT_PATH is configured. The application should mount static files at {APP_ROOT_PATH}/static instead of always using /static.


📓 Logs / Error Output

Browser Console:
GET https://example.com/static/admin.css 404 (Not Found)
GET https://example.com/static/admin.js 404 (Not Found)


🧠 Environment Info

Key Value
Version or commit main@c0ae3d1
Runtime Python 3.11, Gunicorn
Platform / OS macOS
Container Docker

🧩 Additional Context (optional)

#858

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssues / Features awaiting triage

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions