Share URL always uses https:// protocol even for local development #3883

Open
opened 2026-02-16 17:41:48 -05:00 by yindo · 0 comments
Owner

Originally created by @cuevaio on GitHub (Dec 26, 2025).

Originally assigned to: @thdxr on GitHub.

Description

When running the enterprise server locally and using the /share command in the CLI, the generated share URL always uses https:// protocol instead of detecting the actual protocol from the request.

Steps to Reproduce

  1. Run the enterprise server locally: bun dev in packages/enterprise
  2. Configure opencode to use local server: { "enterprise": { "url": "http://localhost:3000" } }
  3. Run /share command in the CLI
  4. The copied URL is https://localhost:3000/share/... instead of http://localhost:3000/share/...

Expected Behavior

The share URL should use http:// when running locally without reverse proxy headers.

Actual Behavior

The share URL always defaults to https:// because the code falls back to "https" when x-forwarded-proto header is not present.

Root Cause

In packages/enterprise/src/routes/api/[...path].ts:

const protocol = c.req.header("x-forwarded-proto") ?? c.req.header("x-forwarded-protocol") ?? "https"

The fallback should detect the actual protocol from the request URL instead of hardcoding https.

Originally created by @cuevaio on GitHub (Dec 26, 2025). Originally assigned to: @thdxr on GitHub. ## Description When running the enterprise server locally and using the `/share` command in the CLI, the generated share URL always uses `https://` protocol instead of detecting the actual protocol from the request. ## Steps to Reproduce 1. Run the enterprise server locally: `bun dev` in `packages/enterprise` 2. Configure opencode to use local server: `{ "enterprise": { "url": "http://localhost:3000" } }` 3. Run `/share` command in the CLI 4. The copied URL is `https://localhost:3000/share/...` instead of `http://localhost:3000/share/...` ## Expected Behavior The share URL should use `http://` when running locally without reverse proxy headers. ## Actual Behavior The share URL always defaults to `https://` because the code falls back to `"https"` when `x-forwarded-proto` header is not present. ## Root Cause In `packages/enterprise/src/routes/api/[...path].ts`: ```typescript const protocol = c.req.header("x-forwarded-proto") ?? c.req.header("x-forwarded-protocol") ?? "https" ``` The fallback should detect the actual protocol from the request URL instead of hardcoding `https`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3883