Skip to content

new-webui: Client app fails when hosted in subdirectory due to missing Vite base configuration #867

@junhaoliao

Description

@junhaoliao

Bug

(issue initially discovered by @haiqi96 )
The client application can only be served from the website root (/) because Vite's configuration is missing the base parameter that needs to be set to "./". This prevents the app from being hosted in any subdirectory or non-root path.

When attempting to serve the application from a path other than the root, the app fails to load assets correctly, resulting in 404 errors for scripts, stylesheets, and other resources; depending on the hosting environment, the response may even be routed to a different application which gives 200 and causes confusion in debugging. This occurs because all asset URLs are generated as absolute paths from the root instead of relative paths.

CLP version

faddfc3

Environment

Chrome
Version 135.0.7049.115

Reproduction steps

  1. Build the client application:
    cd components/log-viewer-webui/client
    npm install
    npm run build
    
  2. Observe the assets were generated under dist.
  3. Serve the application using a simple HTTP server with a path prefix:
    npx http-server
    
  4. Open your browser and navigate to http://localhost:8080/dist/index.html
  5. Open the browser debugger and observe the index.html loads but individual resources fail to load with 404 errors: Browser console shows errors for missing JavaScript and CSS files.
  6. Inspect the index.html source and note that all asset URLs are absolute paths (e.g., /assets/main.js) instead of relative paths (./assets/main.js)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions