The pfSense Store

Author Topic: Captive Portal url:http://x.x.x.x:8002/index.php?zone to http://wireless.hotspot  (Read 540 times)

0 Members and 1 Guest are viewing this topic.

Offline technobiz

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Hi guys, can you help me on this, I really could not make it happen. I want to change the default captive portal url to a domain name.

Captive Portal url:http://x.x.x.x:8002/index.php?zone change to http://wireless.hotspot when clients want to login. What do I need to do.

Pfsense 2.3
« Last Edit: March 12, 2017, 01:31:48 pm by technobiz »

Offline doktornotor

  • Hero Member
  • *****
  • Posts: 8230
  • Karma: +861/-231
  • Not a pfSense employee, they cannot fire me...
    • View Profile
Like https://doc.pfsense.org/index.php/Captive_Portal_Pre-authentication_Redirect ?

Still don't get why'd you change it? They'll get redirected to the login page whether they type http://www.google.com or http://wireless.hotspot as long as it resolves in DNS.
Do NOT PM for help!

Offline technobiz

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Hey sir doktornotor, here it goes, when I connected to the hotspot and open any url, it doens't redirect to the login page instead it sends 404 error page.

Offline technobiz

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
where do you look for this code you are referring?

<?php
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;
}
?>
[Rest of CP login page]

Offline technobiz

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
I did a fresh install of pfsense and capgive portal but still redirection to login page does not work.

Offline Gertjan

  • Hero Member
  • *****
  • Posts: 1759
  • Karma: +142/-6
    • View Profile
This :
.... still redirection to login page does not work.
as a description of your problem will not help us to find out what you forget to mention (and we should know so we can tell you what is wrong).

Tell us more if not everything about your interfaces.
How you set up DNS.
How you set up the portal (configure page).

Start using the default built in login page - and make the portal should work.

You should read : https://en.wikipedia.org/wiki/HTTP_404

Btw : you can not change  http://x.x.x.x:8002/index.php?zone to http://wireless.hotspot
This : http://x.x.x.x:8002/index.php?zone is already incorrect. The "zone" parameter should contains value so pfSense knows WHAT captive zone it's handling (more then one can exist)
This : "8002" is hard coded , and the first web server instance that is running to handle your first instance.
When you use something like "http://wireless.hotspot" it implies "http://wireless.hotspot:80" so you will get redirected .... see instruction here https://doc.pfsense.org/index.php/Captive_Portal_Troubleshooting to see what's really going on.