We've moved discussions to Discord

Seeing 'example.org' host name occasionally on `_url` paths

Stephen Ierodiaconou
Hey everyone, not sure if its something I have done but:

I have noticed occasionally (at least in development) that when my page first loads links rendered via a `_url` path helper have their host name as 'example.org' ... 

eg instead of 'http://localhost:3000/tags/ruby' say, it is 'http://example.org/tags/ruby' . When I reload the page the href is correct (localhost)...

So far I have found it very difficult to replicate and can't find "example.org" in the codebase...

I tried setting up 

ActiveSupport::Reloader.to_prepare do
  ApplicationController.renderer.defaults.merge!(
    http_host: Rails.env.development? ? "localhost" : "my-app.com",

But looks like it has not fixed the issue...

I should note these links are is rendered inside a ViewComponent.

Thanks for any pointers/ideas!
Dustin Fisher
Hey Stephen Ierodiaconou I had a similar issue to this.

To fix it check your config/environments/development.rb file and at the very bottom look for: # You may need to set to include the correct URLs from Turbo, etc 

Un-comment the line below that and set your localhost url and then you should be all good!
Stephen Ierodiaconou
Dustin Fisher  Thanks very much!
Notifications
You’re not receiving notifications from this thread.