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

    Issues with "Log Pages Denied by SquidGuard", again

    Scheduled Pinned Locked Moved Cache/Proxy
    5 Posts 3 Posters 6.8k Views 3 Watching
    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.
    • S
      siz
      last edited by siz

      I'm currently trying to log denied SquidGuard requests at Services -> Squid Proxy Server -> General. I've checked Log Pages Denied by SquidGuard. I'm now wanting to add some code to sgerror.php to allow the logging to work. The hint says:

      Important: This option will only work if you include the code below in your sgerror.php file.
      This forces the client browser to send a second request to Squid with the denied string in URL.
      
      $sge_prefix = (preg_match("/\?/", $cl['u']) ? "&" : "?");
      $str[] = '< iframe > src="'. $cl['u'] . $sge_prefix . 'sgr=ACCESSDENIED" width="1" height="1" > < /iframe >';
      
      Hint: You MUST remove extra spaces in the above iframe HTML tags.
      

      Where do I add this code to sgerror.php (copy of file attached: sgerror.php.txt)?

      I know this has been covered before but none of the answers I could find online are relevant to pfSense v2.4.5.

      K 1 Reply Last reply
      Reply Quote 1
      • K
        kasalencar @siz
        last edited by

        @siz said in Issues with "Log Pages Denied by SquidGuard", again:

        sgerror.php.txt

        Segue um arquivo customizado.
        Abra seu arquivo atual via WebGui
        Diagnostics -> Edit File
        abra o arquivo sgerror.php

        Substitua o conteúdo completo por esse arquivo Customizado
        sgerror.txt

        1 Reply Last reply
        Reply Quote 1
        • JonathanLeeJ
          JonathanLee
          last edited by JonathanLee

          I think after

          	<?php if ($cl['u']): ?>
          		<b> URL:            </b> <?= htmlspecialchars($cl['u']) ?><br/>
          

          Make it ...

          	<?php if ($cl['u']): ?>
          		<b> URL:            </b> <?= htmlspecialchars($cl['u']) ?><br/>
                      <?php 
                          $sge_prefix = (preg_match("/\?/", $cl['u']) ? "&" : "?");
                          $str = '<iframe> src="'. $cl['u'] . $sge_prefix . 'sgr=ACCESSDENIED" width="1" height="1"> </iframe>';
          	     ?>
                        <?= $str ?>
                     <?php endif; ?>
                           
          		<hr size="1" noshade>
          	</body>
          

          Ref:
          https://forums.phpfreaks.com/topic/313731-need-assistance-with-placement-of-code-for-php-script/

          Make sure to upvote

          1 Reply Last reply
          Reply Quote 0
          • JonathanLeeJ
            JonathanLee
            last edited by JonathanLee

            Make sure ..

            "Hint: You MUST remove extra spaces in the above iframe HTML tags."

            $sge_prefix = (preg_match("/?/", $cl['u']) ? "&" : "?");
            $str[] = '<iframe> src="'. $cl['u'] . $sge_prefix . 'sgr=ACCESSDENIED" width="1" height="1"></iframe>';

            But it makes an array,, let me test more

            Make sure to upvote

            1 Reply Last reply
            Reply Quote 0
            • JonathanLeeJ
              JonathanLee
              last edited by

              Screenshot 2023-12-22 at 8.20.54 PM.png

              This seems to work but the logs do not say ACCESSDENIED

              Make sure to upvote

              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