Search code examples
ruby-on-railspuma

Puma not working with actionmailer preview in development mode


I am running rails 4.2.5.1 and puma 2.16.0. The relevant configurations in my development.rb file are

  config.action_mailer.default_url_options = {
    host: 'localhost',
    port: 3000, protocol: 'http' }
  config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
  config.action_mailer.preview_path = "#{Rails.root}/mailers_previews/"

When I go to /rails/mailers then Chrome displays a page 'This webpage is not available'. If I run webrick instead i.e.

rails server webrick

then my mailer previews page is displayed.

I have been using puma in development and production on heroku for several months and everything else works. How do I get puma to display the previews?


Solution

  • With help from the puma project, it turned out that I was using an old url

    http://0.0.0:3000/rails/mailers
    

    when I should have been using

    http://localhost:3000/rails/mailers
    

    The later url works with puma.