Skip to content

Conversation

nadernader99
Copy link

@nadernader99 nadernader99 commented Sep 26, 2025

Support an alternate base path for the Standalone server such that all web UI and API requests can be accessed from a unique root. Ensure backwards compatible if option is not specified.
Fixes #104

Usage Examples
Run in docker:

docker run -e BASE_PATH=/cap -e ADMIN_KEY=your_admin_key tiago2/cap:latest

Configure widget:

<cap-widget 
  data-cap-api-endpoint="/cap/YOUR_SITE_KEY/"
  data-cap-hidden-field-name="cap-token">
</cap-widget>

Server-Side Changes

  • Update all Elysia route prefixes in auth, server, assets, and cap modules to include BASE_PATH
  • Modify static file serving to handle BASE_PATH with custom route for multi-level paths
  • Add redirect route from base path 'without trailing slash' to 'with trailing slash' for proper relative path resolution
  • Add BASE_PATH normalization logic to ensure paths start with / and don't end with /
  • Update console logging to display configured BASE_PATH and endpoint URLs

Frontend Changes

  • Modify login form to dynamically detect base path from current URL for authentication calls
  • Update API client to auto-detect base path from window.location.pathname for all server API calls
  • Ensure relative static asset paths work correctly with trailing slash requirement

Copy link

vercel bot commented Sep 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
cap-docs Ready Ready Preview Comment Sep 26, 2025 3:28pm

@nadernader99 nadernader99 changed the title Add Standalone server optional support for an alternate BASE_PATH. Add Standalone server optional support for an alternate BASE_PATH. FIXES #104 Sep 26, 2025
@nadernader99 nadernader99 changed the title Add Standalone server optional support for an alternate BASE_PATH. FIXES #104 Add Standalone server optional support for an alternate BASE_PATH Sep 26, 2025
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.

[Feature request] Custom base path support for standalone server
2 participants