class AcmeManager::Middleware::ForwardVerificationChallenge

If your setup is such that you cannot use a load-balancer to automatically syphon off LE requests to /.well-known/acme-challenge and direct them to acme-manager, you can use this middleware instead to act as a proxy between LE and acme-manager

Public Class Methods

new(app) click to toggle source
# File lib/acme_manager/middleware/forward_verification_challenge.rb, line 7
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/acme_manager/middleware/forward_verification_challenge.rb, line 11
def call(env)
  if env['PATH_INFO'] =~ %r{\A/.well-known/acme-challenge/}
    AcmeManager.logger.info "Fowarding request to #{env['PATH_INFO']} to #{AcmeManager.config.host}"
    result = Net::HTTP.get_response(URI("#{AcmeManager.config.host}#{env['PATH_INFO']}"))
    [result.code.to_i, result.to_hash, [result.body]]
  else
    @app.call(env)
  end
end