GitHub Codespaces is convenient, but has a few things to be aware of, and some changes that might need changing to work well.
It's worth exploring the supported customisation options provided for tools you might want, or VS Code settings.
The Origin header is incorrectly rewritten, which leads to certain requests failing. This seems to be something Codespaces isn't going to fix, so it needs to be worked around. In Rails, for example:
# config/environments/development.rb
if ENV["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"] == "app.github.dev"
warn "WARNING: (development) Disabling CSRF protection Origin header check!"
config.action_controller.forgery_protection_origin_check = false
endSometimes, an opened port still returns a 401 Unauthorized response even when
everything else is configured correctly.
You might be able to resolve this by making the shared port "public" and then switching back to "private". This then seems to work as expected for the rest of the session.
- Setup problems can usually be understood by browsing the creation log,
- VS Code for the Web generally works terribly in Firefox, but you might be
lucky,
- Pages won't render because of Enhanced Privacy Mode in the "Simple Browser",
- Occasionally, you'll find you can't click in any of the text areas
- GitHub has documented some further troubleshooting steps,
- But be aware that you'll find various bugs which have existed for years and likely won't ever be fixed