rails-reverse-proxy: Keep getting 404

Hi and thanks for sharing this gem. I have followed the instructions, trying to make my site weski.co.il/blog to reverse-proxy our WP which is hosted on different url. my current controller action looks like this:

reverse_proxy "http://roy.zebra-media.co.il/", path: params[:path] ,username: 'xxx', password: 'xxxxxxxxxxxx' do |config|
  config.on_missing do |code, response|
    redirect_to root_path and return
  end
end

It keeps redirecting me to root_path no matter what valid blog path I provide it. Any ideas what can it be?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

I was having same issue. Then I debugged this gem’s code and figured that this part was making my xhr request hitting current domain’s endpoint instead of proxy one. What I had to do was to override host header like so:

reverse_proxy 'https://example.com', headers: { 'host' => 'example.com' }