Skip to content

Fix signing in from GitHub Codespaces - #49

Merged
royalpriest merged 1 commit into
mainfrom
claude/codespaces-sign-in
Nov 18, 2026
Merged

royalpriest merged 1 commit into
mainfrom
claude/codespaces-sign-in

Conversation

@royalpriest

@royalpriest royalpriest commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Signing in from a codespace failed with a 422 error:

HTTP Origin header (https://…-3000.app.github.dev) didn't match request.base_url (http://…-3000.app.github.dev)

Codespaces serves the app over HTTPS but its proxy talks plain HTTP to Rails, so the Origin check fails on every form post. This turns off only the Origin check, only in development, and only when the CODESPACES environment variable is set. The authenticity token is still verified.

Checked by hand with a simulated Codespaces request: before the change it returned 422, after it a 302 into the app. A post without a valid token still returns 422. Rubocop and Brakeman are clean. The change only touches development config, so the test suite doesn't exercise it.

Codespaces proxies HTTPS to plain HTTP, so the Origin header never matched and Rails rejected every form post with InvalidAuthenticityToken. Skip the origin check in development when running in a codespace. The authenticity token is still verified.
@royalpriest
royalpriest merged commit 4b5d7b4 into main Nov 18, 2026
5 checks passed
@royalpriest
royalpriest deleted the claude/codespaces-sign-in branch November 19, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant