Unexpected Origin header ("http://localhost:3000") in POST requests inside GitHub Codespaces despite using .app.github.dev URL #156532
Replies: 3 comments
-
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
-
|
Bumped into this as well with django (we just migrated from gitpod). Looks like this is a won't fix issue from codespaces dev. The only way is to add localhost to the trusted origins. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Bug
Body
I'm running a Ruby on Rails application inside GitHub Codespaces.
While testing a POST request (e.g., submitting a form), Rails rejected it with the following CSRF error:
🔍 Observations
https://solid-capybara-xxxxxxx-3000.app.github.devThis suggests that somewhere between the browser and the Rails app, the
Originheader is being rewritten tohttp://localhost:3000.❓ Is this intentional?
I understand that Codespaces may internally simulate a localhost-like environment for developer convenience. If the
Originheader is intentionally rewritten, that would explain the issue.But in web frameworks like Rails that enforce strict CSRF checks using
Origin, this results in development-time errors unlessconfig.action_controller.forgery_protection_origin_checkis disabled, which is not ideal.✅ What I'm looking for:
💻 Environment:
Thanks in advance for your time and help!
Beta Was this translation helpful? Give feedback.
All reactions