docstrange icon indicating copy to clipboard operation
docstrange copied to clipboard

feat(API): Add root path support for web interface

Open bbeiler-ridgeline opened this issue 2 months ago • 0 comments

This pull request adds support for specifying a custom root path for the DocStrange web interface, improving flexibility for deployments under subpaths (such as behind a reverse proxy). The changes include new CLI options, updates to user instructions and output, and configuration in the web server to honor the root path.

CLI enhancements

  • Added a --root-path argument to the CLI, allowing users to specify a custom root path for the web interface (e.g., /docstrange). This is only used with the web command.

Web server configuration

  • Updated the run_web_app function in docstrange/web_app.py to accept a root_path argument and configure the Flask application’s APPLICATION_ROOT accordingly. This ensures proper routing when the app is served under a subpath.
  • Pass the root_path value to the static content (index.html, script.js) so that the frontend can hit the proper endpoints

Static Content

  • Updated the index.html (template) to store the root_path for use on frontend resources
  • Updated script.js to use the root_path if present (fallback to '') to make calls to the proper api location

@Siddhant011 @prats226

bbeiler-ridgeline avatar Oct 22 '25 13:10 bbeiler-ridgeline