From de126436ef322735c5e72f50cbd575bc2f0484a6 Mon Sep 17 00:00:00 2001 From: Chris <76159444+hunchr@users.noreply.github.com> Date: Wed, 14 Jan 2026 13:36:15 +0000 Subject: [PATCH 1/2] Add URL rewriting in Rails --- go_live.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/go_live.md b/go_live.md index 182eb33a..4507d4cf 100644 --- a/go_live.md +++ b/go_live.md @@ -37,6 +37,23 @@ When preparing your app for production on Deploio, ensure the following: For detailed instructions and best practices, including quick start guides for a variety of frameworks, please refer to the [Deploio deployment documentation](https://guides.deplo.io/user-guide/network-and-deployment.html#network-deployment). +### URL rewriting in Rails + +To prevent the default host (e.g. `main.a1b2c3d.deploio.app`) from being indexed by search engines, +add the following to the `config/routes.rb` file: + +```rb +Rails.application.routes.draw do + if (app_host = ENV["APP_HOST"]).present? + match "*path", constraints: ->(req) { req.host != app_host && !req.path.start_with?("/.well-known/") }, + to: redirect { |_params, req| "https://#{app_host}#{req.fullpath}" }, via: :all + end +end +``` + +Ensure that all custom hostnames are configured on Deploio. +For example, if the app host is `example.com`, configure `example.com`, `www.example.com`, and `example-main.renuoapp.ch`. + ## Heroku * Check the size and amount of dynos on Heroku From 71b2e636f0d85fc8ad6dc036f0412c32824c009d Mon Sep 17 00:00:00 2001 From: Chris <76159444+hunchr@users.noreply.github.com> Date: Thu, 15 Jan 2026 08:29:06 +0000 Subject: [PATCH 2/2] Update --- go_live.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/go_live.md b/go_live.md index 4507d4cf..9b7bde26 100644 --- a/go_live.md +++ b/go_live.md @@ -39,8 +39,10 @@ For detailed instructions and best practices, including quick start guides for a ### URL rewriting in Rails -To prevent the default host (e.g. `main.a1b2c3d.deploio.app`) from being indexed by search engines, -add the following to the `config/routes.rb` file: +Ensure that all custom hostnames are configured on Deploio. For example, if the app host +is `example.com`, configure `example.com`, `www.example.com`, and `example-main.renuoapp.ch`. + +Then, redirect everything to the main hostname by adding the following to your `config/routes.rb` file: ```rb Rails.application.routes.draw do @@ -51,9 +53,6 @@ Rails.application.routes.draw do end ``` -Ensure that all custom hostnames are configured on Deploio. -For example, if the app host is `example.com`, configure `example.com`, `www.example.com`, and `example-main.renuoapp.ch`. - ## Heroku * Check the size and amount of dynos on Heroku