Skip to content

fix(server): bypass auth for frontend static paths#18204

Open
heimoshuiyu wants to merge 1 commit intoanomalyco:devfrom
heimoshuiyu:fix-web-static-auth-bypass
Open

fix(server): bypass auth for frontend static paths#18204
heimoshuiyu wants to merge 1 commit intoanomalyco:devfrom
heimoshuiyu:fix-web-static-auth-bypass

Conversation

@heimoshuiyu
Copy link

@heimoshuiyu heimoshuiyu commented Mar 19, 2026

Issue for this PR

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR bypasses HTTP basic auth for frontend static routes required to bootstrap OpenCode Web correctly when OPENCODE_SERVER_PASSWORD is enabled.

With basic auth enabled, browsers may request static assets/manifests in ways that do not consistently include credentials (e.g. module/crossorigin behavior), causing bootstrap failures and repeated auth prompts.

  • Add a web(path, method) guard for frontend static requests.
  • Allow unauthenticated GET/HEAD for:
    • /
    • /index.html
    • /site.webmanifest
    • /favicon.ico
    • /robots.txt
    • /oc-theme-preload.js
    • /assets/*
  • Keep auth protection for non-static API routes.

How did you verify your code works?

none, it is simple

Screenshots / recordings

none

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Contributor

Hey! Your PR title server: bypass auth for frontend static paths doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions bot added needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Mar 19, 2026
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

@heimoshuiyu heimoshuiyu changed the title server: bypass auth for frontend static paths fix(server): bypass auth for frontend static paths Mar 19, 2026
@github-actions github-actions bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Mar 19, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

1 participant