Applying @bartt's patch from https://github.com/bartt/rack-ssl