ndreckshage
ndreckshage

Reputation: 873

Multiple subdomains on Heroku (Rails)

I have staging.example.com, and want to have blog.staging.example.com (to test prior to blog.example.com).

In my Heroku settings, I added 'staging.example.com' and 'blog.staging.example.com' as site domains. On DNSimple, I added 'staging.example.com' and 'blog.staging.example.com' as CNAMEs both, pointing to 'proxy.herokuapp.com'.

staging.example.com is a separate Heroku repo than example.com. But blog.staging.example.com is part of the same Rails application as staging.example.com (hopefully that makes sense).

I have this working in development, with

constraints subdomain: 'blog' do
  root to: 'blog#index'
end

However, both staging.example.com and blog.staging.example.com point to staging.example.com.

Upvotes: 2

Views: 895

Answers (1)

ndreckshage
ndreckshage

Reputation: 873

Alright figured it out.

root to: 'blog#index', constraints: { subdomain: /^blog(\.|$)/ }

Upvotes: 2

Related Questions