score:0

Accepted answer

the reason you're seeing a redirect is that there's an implicit conversion from a string to a redirect to / (by default) with a lift error notice set.

the string is used as the value of the error notice, which you can see displayed if you have lift notices included on the page. it looks like the implicit is called strtofailmsg.

the recipe access restriction by http header in the lift cookbook touches on this briefly.

score:0

menu.i("topic") / "topic" >> if(() => false, redirectresponse("/"))

score:0

what lift version are you using?

in both lift 2.4 and lift 2.5, failmsg is a alias of () ⇒ liftresponse, so just simply provide it with notfoundresponse("myerror") should work.

menu.i("topic") / "topic" >> if(() => false, () => net.liftweb.http.notfoundresponse("myerror"))

Related Query