Kohana 3.3 force SSL in controller -
Kohana 3.3 force SSL in controller -
i have few controllers. https redirected webserver (ligttpd) itself, security-check want php redirect specific controllers https.
does kohana contain function check if url running on ssl , redirect if needed?
found out own reply :)
make class called url:
class url extends kohana_url { public static function ssl() { if (!isset($_server['https']) || $_server['https'] == "") { $redirect = "https://" . $_server['http_host'] . $_server['request_uri']; header("location: $redirect"); } } }
call in controller this:
url::ssl();
please note: using above method unsafe. should redirect server (lighttpd/nginx/apache) too.
ssl controller kohana
Comments
Post a Comment