Home Blog redirection to directory in Heroku app is not working for blog post urls
Reply: 0

Blog redirection to directory in Heroku app is not working for blog post urls

user1477
1#
user1477 Published in April 26, 2018, 5:29 pm

I followed this tutorial in order to redirect my blog hosted on a subdomain (blog.botletter.com) to a directory of my Heroku rails app (https://www.botletter.com/blog/).

The redirection works for the main page of the blog (/blog/) but does not for the articles URLs.

I guess it's a problem of configuration within the Rails app but I can't find the mistake. Here is the log in Heroku:

at=info method=GET path="/blog/invite-team-members/" host=www.botletter.com request_id=23b81c9a-e20b-4261-aea4-87adfb781554 fwd="195.154.32.17" dyno=web.1 connect=0ms service=412ms status=500 bytes=725 protocol=https

Here is my config.ru file (I don't use username and passwork like in the tutorial as the blog is not using any access restriction):

require_relative 'config/environment'

use Rack::ReverseProxy do
  reverse_proxy /^\/blog(\/.*)$/, 'https://blog.botletter.com$1', :timeout => 500, :preserve_host => true
end

run Rails.application

My routes:

get '/blog' => redirect("https://www.botletter.com/blog/")
get '(*path)', to: 'application#blog', constraints: { subdomain: 'blog' }

My "blog" action in the application controller:

def blog
    redirect_to "https://www.botletter.com/blog#{request.fullpath.gsub('/blog','')}", :status => :moved_permanently
  end

Thanks for your help!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.351335 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO