Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request from SSL app to non-ssl application - How to disable SSL for redirected req? #83

Open
geedon opened this issue Aug 20, 2019 · 1 comment

Comments

@geedon
Copy link

geedon commented Aug 20, 2019

I have an SSL enabled application and I'm redirecting a specific request to an older application, in order to avoid CORS issues. In fact this is a .Net application that will process print requests but it does not support SSL. The redirected request tries to connect with SSL resulting with the following in the Rails app logs...

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3/TLS write client hello: wrong version number):

The other application simply doesn't support SSL so its nothing to do with verifying SSL certificates or SSL version numbers.

Currently I'm using the following function, which works a treat when the app is not running in under SSL....

`def perform_request(env)

request = Rack::Request.new(env)

if request.path.include? "proxy_process_dispatch"

  env["http.read_timeout"] = (OFFICE_PRINT_TIMEOUT / 1000) - 1

  env["HTTP_HOST"] = OFFICE_IP + ':' + OFFICE_PRINT_SERVER_PORT     

  puts 'Redirecting dispatch process request to: ' + env["HTTP_HOST"] + '. Read timeout set to ' + env["http.read_timeout"].to_s

  env["REQUEST_PATH"] = "/?process=true"

  super(env)

else

  @app.call(env)

end

end

`

Can you help me to disable SSL for this specific request?

@exo
Copy link

exo commented Nov 26, 2019

I encountered this and managed to get the right behaviour by rewriting the header and rack config values in env that indicated the request was HTTPS before passing the request on to rack-proxy.

e.g.

    env["HTTP_X_FORWARDED_PROTO"] = "http"
    env["rack.url_scheme"] = "http"
    super(env)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants