rails-reverse-proxy icon indicating copy to clipboard operation
rails-reverse-proxy copied to clipboard

Need a way to debug the requests and responses

Open starrychloe opened this issue 5 years ago • 2 comments

Need a way to turn on verbose mode for debugging like curl -i or curl -v to see what the requests are sending.

I have

    logger.debug request.path
    logger.debug host
    logger.debug path
    reverse_proxy host, path: path do |config|
      config.on_redirect do |code, response|
        logger.debug response['location']
        render text: "Redirected"
        return
      end

And it is redirecting to https://localhost/ for no reason at all!

/posts
https://wordpresssite.com/
category/guides/
https://localhost/category/guides/
  Rendered text template (0.0ms)

It works with curl and doesn't redirect. I want to know what it's sending. What is the User-Agent? What is the Referer? Etc.

starrychloe avatar Oct 20 '18 16:10 starrychloe

Through trial & error, I discovered by adding the following then it worked. But we still need a way to debug.

headers: {'Host' => "wordpresssite.com"}

starrychloe avatar Oct 29 '18 15:10 starrychloe

I'm also trying to figure out why my proxy requests are failing, but I can't find any way to debug this gem.

There's nothing in the logs and I don't know how to turn on debugging if there is such option for this gem?

vfonic avatar Nov 01 '21 11:11 vfonic