What do you consider the best practice to handle locales and internationalization in a Rails app on Heroku in a RESTful way? What is your bit of code that gateways the user according to their locale? Is a subdomain solution (http://de.myapp.com, http://en.myapp.com, …) possible without the wildcard subdomain add-on on Heroku?
I don't believe there is anything to stop you using http://de.myapp.com, http://en.myapp.com and friends on Heroku.
Rather than using wildcard domains, what you'd have to do is:
Manually configure your DNS domain to provide 'true' DNS names for each locale.
Add each domain manually using the (free) Custom Domain plugin.
Obviously this is a bit more work than using wildcard domains, but should be fine unless you've got a lot of locales to manage.
You have different options to set the locale, e.g. you could as well go with myapp.com/en/... .
See RailsGuides for more information. There is no need to mess with domains unless you absolutely want to :)
Related
This may have been answered before (it seems relatively common) but for the life of me I cannot find it, so here we are.
I'm creating a relatively straightforward Ruby on Rails app and am (was?) planning on hosting it on Heroku since I'm already setup there.
The problem I'm having is that I'm creating a landing page builder that needs to allow users to view their website at something like https://their-app.my-app.com. Of course, there will be users who will also want to point their own domains (ex. their-app.com) to that subdomain via a CNAME.
1) Is it possible on Heroku to do that without having to add each one as a custom domain (which of course isn't realistic due to customers being able to add their own).
2) Any recommendations on which service might be the best for hosting this kind of setup? I really love the heroku PaaS setup but of course.. this is a requirement.
Side note: WHen doing it now (Creating a CNAME to point a domain name at the subdomain my app created) I currently get a Heroku page saying "No App Found at this Domain", etc.
Thanks!
Yes, this is doable and automatable on Heroku.
Using the Heroku Platform API, you can programmatically point domains to an app.
Then, your customer will have to point their domain to the value of the cname attribute provided by Heroku.
All over the internet there are tons of posts about this, but no answers.
In my Rails app running on Heroku, can I allow my Users to add their own Custom Domains automatically? Does Heroku allow this?
Are there add-ons to help with this
By custom domains, I mean adding using their own top-level-domain,
not Subdomains. E.g., example.com
Here's one solution to allow this:
Set up a wildcard subdomain (for your app's domain) that points to your Heroku app.
Allow users to set a custom subdomain.
Users can then set up a CNAME (or ALIAS or ANAME, as described here) that points to their custom subdomain on your app.
Yep, it's definitely possible - you have to use the Heroku gem within your application and when they add domains you need to make an API call to add their chosen custom domain to your application.
If you want to be able to use SSL it won't work AFAIK because you can only have one SSL addon per app - however, subdomains are easier since you can do a wildcard subdomain and then it's also possible to use a wildcard SSL on your domain without having to involve making API calls and you then don't have to get your clients edit their DNS to point at your application.
We're hosting a Rails 3 app on Heroku. Heroku suggests redirecting naked domains (example.com) to sub-domains (www.example.com) when using their service. This is because they prefer CNAMES over A records (since their IP address might occasionally change).
However, personally I'd prefer to use a naked domain (instead of www) for our site. We're using DNSimple to manage the DNS for our site. If we use their ALIAS feature, does this mean that we should be able redirect all traffic to the naked domain without any worry?
Also, is there anything else we should be aware of when using a naked domain on Heroku, besides following this advice in regards to SSL?
DNSimple ALIAS record negates the problems usually experienced with naked domain so you will be fine.
I believe you can set a wildcard domain to allow your app to control the routing if any subdomains... Here's what heroku says: https://devcenter.heroku.com/articles/custom-domains
I'm not sure of the security that way, but it might be a solution for you.
I would like to have different applications under the same domain using Heroku.
Because of the name of the domain, I would like to access the applications using folders (mydomain.com/app) instead of using subdomains (app.mydomain.com), is this possible? Thanks
There is no type of URL re-writing you have access over thats going to do that for you. You could create a "stub" Siantra-based app that allows you to define those types of URLs, but it would have to effectively redirect you to the subdomain version.
I'd have to play devil's advocate and ask why you'd want to have things namespaced as /app instead of using subdomains. Subdomains offer much more flexibility and are a lot less brittle than essentially having to url-rewrite all the time based on the first "slash" element.
You can't do this with heroku - it assumes the directory structure of the Rails application.
I have two Rails apps that I want to serve with Passenger from the same domain.
I would like requests to come in to one app, and if that app is not able to handle the request, for the request to be passed to the the second app.
I know that I can use Passenger's RailsBaseURI option to deploy multiple apps to different sub URIs, but this doesn't give the behaviour I'm after.
Is there a standard way to achieve this?
Thanks in advance, etc etc.
I think you can use haproxy as a load balancer.