Created
September 5, 2012 18:55
-
-
Save kvirani/3642524 to your computer and use it in GitHub Desktop.
require ssl without apache on localhost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def require_ssl | |
if request.protocol != SECURE_PROTOCOL | |
redirect_to :protocol => SECURE_PROTOCOL | |
else # development or test | |
logger.info "redirected to ssl" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECURE_PROTOCOL = 'http://' # this will be HTTPS for staging/prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECURE_PROTOCOL = 'https://' # This will be HTTP for dev/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECURE_PROTOCOL = 'https://' # This will be HTTP for dev/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECURE_PROTOCOL = 'http://' # This will be HTTP for dev/test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Subsequently, your internal page links that should switch to HTTPS can use the SECURE_PROTOCOL instead of 'https://' directly