Skip to content

Support serving iscc-web under a URL path prefix #67

Open

Description

@titusz

Problem

iscc-web only works at the root of a domain or subdomain (https://iscc.example.com/). It cannot be served under a path prefix such as https://intranet.example.com/iscc/, which is a common requirement for internal and permissioned deployments that share one hostname.

Absolute root paths are hard-coded in several places:

  • Frontend: frontend/services/api.service.ts calls /api/v1/...; Vite builds with base: "/static/dist/".
  • Backend: iscc_web/vite.py (VITE_STATIC_URL = "/static/dist/"); iscc_web/api/common.py base_url() and the Location headers in iscc_web/api/iscc.py and iscc_web/api/media.py build /api/v1/... URLs; routes are mounted at /static, /docs, /images and /health in iscc_web/main.py.
  • API docs page: iscc_web/static/docs/index.html loads /static/... and /docs/openapi.yaml; openapi.yaml declares servers: /api/v1 (and / for /health).

A reverse proxy that strips the prefix gets the API working, but the page and the URLs in API responses still point at the root.

Proposal

Add an option ISCC_WEB_ROOT_PATH (empty by default) for deployments behind a proxy that strips the prefix:

  • Backend: prefix generated URLs (base_url(), Location headers, Vite asset tags, docs page asset paths) with the root path. ASGI root_path may cover part of this.
  • Frontend: read the prefix from the injected window.__ISCC_WEB__ config instead of hard-coding /api/v1, and build assets relative to it.
  • Docs page: serve it through the template, or make its asset and spec paths relative.

Done when

  • The demo page, uploads, downloads, metadata embedding, /docs and /health work under a prefix behind a stripping proxy, and the URLs in API responses carry the prefix.
  • The default (no prefix) behaves exactly as today.
  • Tests cover URL generation with and without a root path; the deployment docs show a prefixed proxy configuration.

Until then, the "Run behind a login" guide documents that iscc-web needs its own domain or subdomain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions