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

username and password don't seem to be respected

Open dudo opened this issue 7 years ago • 0 comments

This is my code... I'm still asked to login, though. Any idea? username and password are definitely correct.

def _reverse_proxy(endpoint=nil)
  @url = Settings.wordpress.url
  @path ||= [endpoint, params[:path]].compact.join.gsub('//', '/')
  reverse_proxy @url, options do |config|
    config.on_missing do |code, response|
      redirect_to root_url and return
    end
  end
end

def options
  source_request = URI(@url)
  {
    headers:    {
      "HOST" => source_request.host,
      "X-Forwarded-Host" => source_request.host,
      "X-Forwarded-Port" => source_request.port.to_s,
      "X-Forwarded-Proto" => source_request.scheme,
    },
    path: @path,
    username: Settings.wordpress.username,
    password: Settings.wordpress.password,
    verify_ssl: Rails.env.production?
  }.with_indifferent_access
end

dudo avatar Aug 16 '18 23:08 dudo