'Rails ActiveStorage attachment host not working with Postman

I have a problem with getting attachments urls with ActiveStorage, using rails 6.1.4.6 and ruby 2.6.6

In my development.rb I did set routes.default_url_options[:host] = 'my_host' and checking in console everything is working: Rails.application.routes.default_url_options[:host] i get the right host.

Right host

But when using postman, the default url is falling back to localhost: http://localhost:3000/rails/active_storage...

enter image description here

Is there a way to set default host on development environment?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source