Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    [pfsense-2.3.1] captive portal redirect-url before auth

    Scheduled Pinned Locked Moved Captive Portal
    37 Posts 17 Posters 24.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aurel
      last edited by

      Hey

      On captive portal i use redirection url before authentication.

      Before pf 2.3 for come back to index captive portal  i used https://mydomain.com:8003 and everything work fine but since 2.3 when i use the same nothing happen (not redirecting, blank page)

      if i use captive portal without redirection it's work

      if i use the same url in redirection case it's not work i loop on redirection and i never get the index captive portal

      Any idea

      i try :
      https://domain.com:8003/index.php = blank page
      and
      https://domain.com:8003/index.php?zone=zone_name = loop on redirect

      1 Reply Last reply
      Reply Quote 0
      • A
        aurel
        last edited by

        The problem is not of url but of this code

        it doesn't works in 2.3 version can you help me

        
        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;
        }
        ?>
        
        
        1 Reply Last reply
        Reply Quote 0
        • GertjanG
          Gertjan
          last edited by

          :8000 ?

          From what version did you upgrade ?
          What I recall is that port "8000" hasn't been used for years - and, first of all, shouldn't be hard coded anywhere.

          It easy to proof this to yourself : use a no tampered pfsense portal  (clean install - minimal setting) and a clean browser.
          Then go to http://www.google.com (NOT https://www.goolge.com) and it works ….

          If you have portal troubles, please know that this one exists : https://doc.pfsense.org/index.php/Captive_Portal_Troubleshooting

          Can you tell me (and yourself) what this command gives back :

          ipfw -x 2 show | grep 'fwd'
          

          "x 2" because the command "ipfw zone list" said me to do so.

          No "help me" PM's please. Use the forum, the community will thank you.

          1 Reply Last reply
          Reply Quote 0
          • A
            aurel
            last edited by

            8000 it's an error (it's old port) sorry it's 8003 in my config

            so captive portal work perfectly with redirect-url before authentication in 2.2

            i upgrade in 2.3 and problem appear

            the command said fwd on port 8002 tcp 80 but i have juste one zone on port 8003

            i think to delete portal and go to config from scratch

            what do you think about?

            1 Reply Last reply
            Reply Quote 0
            • A
              aurel
              last edited by

              so i'm test config from scratch (i delete the old portal and recreate it)

              Now loop stop but stay on blank page

              https://domain.com:8003/index.php = blank page
              and
              https://domain.com:8003/index.php?zone=zone_name = blank page

              1 Reply Last reply
              Reply Quote 0
              • V
                vikram29
                last edited by

                Hi All,

                Me too facing a similar issue.

                I need to show a video before authenticating. The video shows correctly before authentication but it doesn't redirect to the CP.
                I placed a link on the video page http://10.10.10.1:8002/?zone=local and also http://10.10.10.1:8002/index.php but both return a blank page when the link is clicked.
                Me too running 2.3 version.

                Please help.

                Regards,
                Vikram

                1 Reply Last reply
                Reply Quote 0
                • GertjanG
                  Gertjan
                  last edited by

                  @aurel:

                  https://domain.com:8003/index.php = blank page
                  and
                  https://domain.com:8003/index.php?zone=zone_name = blank page

                  Basic - normal 'http' works ? If so, its a https (SSL == certificate issue ?)
                  If not, it could be a DNS "domain.com" issue (pfSense needs to knwo who "domain.com" so it can inform the client, because browser can not work with "domain.com", they use "IP/index.php like 192.168.2.1/index.php. If the translation "domain.com" to "192.168.2.1" (done by pfSense) doesn't work, then do not use "domain.com" (which has to be used if you activated "https" login - certoficates works with domaine names, nt IP's), or do not use https.

                  Btw : go here and read the very first subject https://forum.pfsense.org/index.php?board=2.0 not all is important for you, but it shwon what need to be done so https login works.
                  Actually, it explain how to set up a https web server (the one used by pfSense which presents a login page to the visitor) - it can be pretty daunting if it is your first time …..

                  No "help me" PM's please. Use the forum, the community will thank you.

                  1 Reply Last reply
                  Reply Quote 0
                  • A
                    aurel
                    last edited by

                    Hey
                    With ip address it is the same problem
                    Https work find whitout pre-auth redirect URL, it is really in this case when you want tout go back from the page to CP index

                    1 Reply Last reply
                    Reply Quote 0
                    • V
                      vikram29
                      last edited by

                      Hey,

                      The problem is solved. Using different method although.
                      Reference post https://forum.pfsense.org/index.php?topic=4937.msg61808#msg61808

                      Regards,
                      Vikram

                      1 Reply Last reply
                      Reply Quote 0
                      • A
                        aurel
                        last edited by

                        No it is a different method but this problem is not solved. ;)

                        1 Reply Last reply
                        Reply Quote 0
                        • GertjanG
                          Gertjan
                          last edited by

                          I agree, I do not understand  what the difference is between:
                          "Pre-authentication redirect URL" (html : preauthurl)
                          and
                          "After authentication Redirection URL" (html : redirurl)

                          If "After authentication Redirection URL" is set (and only that one) with an URL, I get redirected to that page after login.
                          If "Pre-authentication redirect URL" is set (and only that one), I get redirected to that page after login.

                          Now, check out the code in /etc/inc/captiveportal.inc - line 1952.
                          The codes explains what happening ….. but now, what is the meaning of "Pre-authentication redirect URL" if both "Pre-authentication redirect URL" and "After authentication Redirection URL" are present (the second overwrites the first when both set)

                          Do you need the "Pre-authentication redirect URL"  page ? (which means to me : before the login page, visitor are redirected else where )

                          No "help me" PM's please. Use the forum, the community will thank you.

                          1 Reply Last reply
                          Reply Quote 0
                          • A
                            aurel
                            last edited by

                            "Pre-authentication redirect URL" (html : preauthurl)
                            and
                            "After authentication Redirection URL" (html : redirurl)

                            In fact if you want "force" user to see something else for exemple contract agreement, advertising etc.. you use pre-authentication redirect URL.

                            After user logon the captive portal he is redirect to a website (for exemple a famous search engine ;) ) but he can go where he want ….before not

                            1 Reply Last reply
                            Reply Quote 0
                            • GertjanG
                              Gertjan
                              last edited by

                              @aurel:

                              In fact if you want "force" user to see something else for exemple contract agreement, advertising etc.. you use pre-authentication redirect URL.

                              After user logon the captive portal he is redirect to a website (for exemple a famous search engine ;) ) but he can go where he want ….before not

                              Yep, that's what I make of it ….

                              But, if you can 'read' some PHP :
                              @Gertjan:

                              Now, check out the code in /etc/inc/captiveportal.inc - line 1952.

                              which I find surprising.

                              No "help me" PM's please. Use the forum, the community will thank you.

                              1 Reply Last reply
                              Reply Quote 0
                              • J
                                julio_cdn
                                last edited by

                                @aurel:

                                The problem is not of url but of this code

                                it doesn't works in 2.3 version can you help me

                                Usar el sgte codigo

                                o en todo caso agregar la linea , a su portal que ya tengan.

                                Saludos

                                
                                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;
                                }
                                ?>
                                
                                
                                1 Reply Last reply
                                Reply Quote 0
                                • empbillyE
                                  empbilly
                                  last edited by

                                  For me was happening the same problem. I have a custom page to make the user login, but after the update did not occur redirection. I checked my .html file and noticed a slight difference. The code below was missing.

                                  P.S. At the configuration page of the captive portal has this information.

                                  Example code for the form:
                                  
                                  

                                  I put this entry and voila !!! It worked!!! In 2.2.6 version I didn't have this line and was working normal.

                                  Some explanation?

                                  https://eliasmoraispereira.wordpress.com/

                                  1 Reply Last reply
                                  Reply Quote 0
                                  • G
                                    ghinthsh
                                    last edited by

                                    @empbilly:

                                    For me was happening the same problem. I have a custom page to make the user login, but after the update did not occur redirection. I checked my .html file and noticed a slight difference. The code below was missing.

                                    P.S. At the configuration page of the captive portal has this information.

                                    Example code for the form:
                                    
                                    

                                    I put this entry and voila !!! It worked!!! In 2.2.6 version I didn't have this line and was working normal.

                                    Some explanation?

                                    Nice to know CP works in 2.3

                                    I'll try it later i hope it is the same for pfsense 2.3 clean installation using the same procedure.

                                    1 Reply Last reply
                                    Reply Quote 0
                                    • A
                                      aurel
                                      last edited by

                                      yes in 2.3 you must change index page and add the zone field

                                      for me it's when i use the pre-redirurl before authentication

                                      i can't return on the captive portal to connect me

                                      the url

                                      https://hotspot.domain.com:8005/index.php?zone=zone_name

                                      loop on pré-redirurl page

                                      i think that code below is a part of my problem

                                      
                                      $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;
                                      }
                                      
                                      
                                      1 Reply Last reply
                                      Reply Quote 0
                                      • GertjanG
                                        Gertjan
                                        last edited by

                                        @aurel:

                                        the url
                                        https://hotspot.domain.com:8005/index.php?zone=zone_name
                                        loop on pré-redirurl page

                                        Maybe.
                                        But who is gonna use an URL like that ?

                                        My setup permits me to :
                                        People visit a http site (let's say : http://www.google.com)
                                        They are intercepted, and redirected to my captive portal page : (which is : https://portal.my-pfsense-domain.tld/….. but who cares)
                                        They identify themselves.
                                        When accepted, they are redirect to the initial URL they were requesting, in this case http://www.google.com

                                        No "help me" PM's please. Use the forum, the community will thank you.

                                        1 Reply Last reply
                                        Reply Quote 0
                                        • A
                                          aurel
                                          last edited by

                                          for me

                                          https://doc.pfsense.org/index.php/Captive_Portal_Pre-authentication_Redirect

                                          not working on 2.3

                                          can i open a bug in pfsense redmine project ?

                                          1 Reply Last reply
                                          Reply Quote 0
                                          • R
                                            Riroxi
                                            last edited by

                                            same issue here on 2.3

                                            1 Reply Last reply
                                            Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • First post
                                              Last post
                                            Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
                                            Privacy Policy · Cookie Policy