Skip to content

Feature: JSS as a CORS proxy for git remotes (with optional paid access via HTTP 402) #377

Description

@melvincarvalho

Background

JSS already exposes git smart-HTTP via --git and supports HTTP 402 paid access via --pay. Combining these would let a JSS pod act as a CORS-enabled, optionally-paid gateway for browser-side git clients to any remote git server (GitHub, GitLab, Gitea, other JSS pods, etc.).

Why

Browser-side git clients (e.g., JSS Git, built on isomorphic-git) hit CORS preflight failures against major git hosts that don't return browser-friendly headers. Public CORS proxies (cors.isomorphic-git.org) exist but introduce third-party dependencies, privacy concerns, and uptime risk.

A JSS-native proxy would let pod operators:

  • Self-host the bridge (no third-party trust)
  • Optionally monetize the proxy via per-request HTTP 402 pricing
  • Stay within the Solid + Lightning stack already shipping in JSS

Proposed feature

New flag --git-proxy enables a proxy endpoint that:

  1. Accepts requests at /git-proxy/<remote-url-or-path>/info/refs?...
  2. Forwards the request to the remote git host with appropriate headers (Git-Protocol, Authorization if provided)
  3. Returns the response with CORS headers attached (Access-Control-Allow-Origin, Access-Control-Allow-Headers: Git-Protocol, Content-Type, etc.)
  4. Handles binary responses (pack files) correctly
  5. Optionally pricing-gated via HTTP 402 (--pay integration: each proxy request debits the caller's balance per --pay-cost)

URL scheme options

Option Example
A. Path-encoded /git-proxy/https%3A%2F%2Fgithub.com%2Fuser%2Frepo.git/info/refs
B. Subpath mirror /git-proxy/github.com/user/repo.git/info/refs
C. Query param /git-proxy/info/refs?upstream=https://github.com/user/repo.git

Recommend B for cleaner URLs and easier client handling.

Composing with --pay

Pricing tiers (configurable):

  • Free up to N requests/hour per WebID (rate-limited)
  • Paid above that: deduct --pay-cost per request from caller's ledger balance
  • HTTP 402 returned when balance insufficient
  • Bandwidth-priced option (--pay-per-byte) for large clones

Marketing story

"JSS Git browses any git repo — your pod, GitHub, Gitea, anywhere — by routing through a pod-hosted proxy. Free for friends; sat-per-request for strangers."

Pulls together: Solid + git smart-HTTP + Lightning + browser-side cloning. A complete decentralized git-hosting story.

Refs

  • src/handlers/git.js — existing git handler
  • src/handlers/pay.js — existing payment + ledger
  • src/wac/checker.js — WAC payment conditions
  • JSS Git frontend: github.com/JavaScriptSolidServer/git
  • isomorphic-git CORS proxy spec: https://isomorphic-git.org/docs/en/cors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions