Closed joshaber closed 1 year ago
@joshaber I thought you might want to know that this out of the box config doesn't seem to be working on new codespaces on the current Rails release. I think it has not worked since https://github.com/rails/rails/commit/0fccfb9a3097a9c4260c791f1a40b128517e7815 though it may be earlier.
Here is a test that shows the issue: https://github.com/rails/rails/compare/main...ghiculescu:rails:codespaces-bug
The [".githubpreview.dev", ".app.github.dev"]
comes from the Dockerfile via the RAILS_DEVELOPMENT_HOSTS
env var (PR), and "ghiculescu-urban-lamp-asdfasdgsafda-3000.preview.app.github.dev"
is the (lightly sanitized) URL of my codespace.
It looks like because it is a sub-subdomain it isn't permitted. I mentioned this to someone else who regularly does Rails development on codespaces and he said "oh yeah you have to add config.hosts", which is fine, but given there was a lot of work put into making it work out of the box I thought you might want to know.
Thanks for all your work on Codespaces!
cc @dmilburn
I wrote all that post and then I realised the fix was just to add this config:
config.hosts << ".preview.app.github.dev"
Perhaps that could be added to the template?
@ghiculescu great catch, thank you for pointing it out! I've opened https://github.com/devcontainers/templates/pull/83 and https://github.com/devcontainers/images/pull/262 to resolve it.
Codespaces is migrating port forwarding to live under
app.github.dev
so we need to update the defaultRAILS_DEVELOPMENT_HOSTS
to reflect that.