LiftRules.earlyResponse.append((r: Req ) => if (r.request.scheme != "https") Full(NotFoundResponse("https only")) else Empty)
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
I agree with Damian. Just wanted to say that Liftafarians should absolutely be the official designation applied to all who inhabit Liftland :)
--On Wed, Jun 13, 2012 at 9:04 AM, Damian Helme <damia...@gmail.com> wrote:
Would something like this work?LiftRules.earlyResponse.append((r: Req ) => if (r.request.scheme != "https") Full(NotFoundResponse("https only")) else Empty)
On Wednesday, 13 June 2012 07:47:20 UTC+1, Jonathan Ferguson wrote:Dear Liftafarians,I am assuming it is a custom LocParam applied to all menu items of the sitemap. Thought I'd ask as someone may have a better solution.Please ignore the temptation to suggest doing it in another layer of the application stack as this isn't possible.CheersJono--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
CheersJono--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
On Tue, Jun 12, 2012 at 11:47 PM, Jonathan Ferguson <jo...@spiralarm.com> wrote:Dear Liftafarians,I am assuming it is a custom LocParam applied to all menu items of the sitemap. Thought I'd ask as someone may have a better solution.Please ignore the temptation to suggest doing it in another layer of the application stack as this isn't possible.So... the problem is that if you're running behind a proxy (e.g., Nginx), it's not possible to determine if the original request was HTTPS. That would be something you'd have to configure in your front end proxy.
We don't have access to the front end proxy.
secure
Set this attribute to true
if you wish to have
calls to request.isSecure()
to return true
for requests received by this Connector. You would want this on an
SSL Connector or a non SSL connector that is receiving data from a
SSL accelerator, like a crypto card, a SSL appliance or even a webserver.
The default value is false
."
if (Props.productionMode) {
LiftRules.earlyResponse.append((req: Req) ⇒ if (req.request.scheme != "https") {
Full(PermRedirectResponse("https://%s%s".format(req.request.serverName, req.request.uri), req, req.cookies: _*))
} else { Empty })
}
I have tried the following on Cloud Foundry and get a permanent redirect errorThe logger line seems to show about 10-15 lines showing redirecting from http://... to https://... which seems to indicate that the redirect is not being followed.if (Props.productionMode) {LiftRules.earlyResponse.append((req: Req) => if (req.request.scheme != "https") {logger.info("Redirecting from %s://%s%s to https://%s%s).format(req.request.scheme, req.request.serverName, req.request.uri, req.request.serverName,req.request.uri))
Full(PermRedirectResponse("https://%s%s".format(req.request.serverName, req.request.uri), req, req.cookies: _*))}else {Empty})}
Any Ideas?
CheersRC
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code