Captive Portal "Pre-authentication redirect URL" not working (BUG???)
-
It's seems that there is a problem with this field, some of the users, including me, are reporting this option to be useless right now.
Does anybody knows if there is a way to fix it or a work around?
Thanks! :) -
It works fine, there is no bug, it just requires a particular set of circumstances and some custom code on the actual captive portal page to work properly.
I seem to recall explaining it before in the forum, but I could be wrong, try searching a bit and seeing what turns up.
-
It works fine, there is no bug, it just requires a particular set of circumstances and some custom code on the actual captive portal page to work properly.
I seem to recall explaining it before in the forum, but I could be wrong, try searching a bit and seeing what turns up.
Thanks, here is the result of my search, i hope it's going to help others having the same problem right now….well, after having another look, probably that's not gonna help much, sorry, i will try harder :D
![Search Result.jpg](/public/imported_attachments/1/Search Result.jpg)
![Search Result.jpg_thumb](/public/imported_attachments/1/Search Result.jpg_thumb) -
Ok i found something here: http://forum.pfsense.org/index.php/topic,34148.0.html
A quick copy & past of the relevant answer
–--------------------------------------------------------------------------------------------------
_jimp
Administrator
Hero MemberOffline
Posts: 9922
Re: Pre-authentication redirect URL
« Reply #4 on: March 30, 2011, 11:07:05 am »
–------------------------------------------------------------------------------The pre-auth URL will do that, but you need a captive portal page that actually does the redirect to the CMS page, and the CMS server's IPs need to be added as captive portal bypass IPs or hostnames if it's on a separate subnet.
The pre-auth URL field probably needs a better note saying it requires a special captive portal page be uploaded. You really just need a bit of code at the top of the page (it can be a .php file)
Code:
require("globals.inc");
$request_uri = urldecode(str_replace("/index.php?redirurl=", "", $_SERVER["REQUEST_URI"]));
$portal_redirurl = urldecode("$PORTAL_REDIRURL$");
if(!stristr(urldecode("$PORTAL_REDIRURL$"), $request_uri)) {
Header("Location: $PORTAL_REDIRURL$");
exit;
}
?>That does require that your landing page on the CMS server redirect them back to the direct CP URL, http://x.x.x.x:8000/index.php - but it could be rewritten to check for a referer or some other scheme. It isn't as easy as doing a post-auth redirect to another page._
-
Yeah that's the post I was talking about. That's everything you need to know about how to make it work.