I would like to create an rack application for deployment of heroku to create some 301 redirects to other subdomains.
If the path would be carried over, it would be nice.
I started with the following code, but it isn't working:
require 'rack-force_domain'
use Rack::ForceDomain, ENV["DOMAIN"]
run lambda { |env| [200, {'Content-Type'=>'text/plain'}, StringIO.new("Hello World!\n")] }
I solved this problem by using sinatra finally. That's my config.ru:
require 'sinatra'
get %r{(.*)} do
redirect to("http://custom.domain#{params[:captures].first}"), 301
end
run Sinatra::Application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With