Monday, January 7, 2008

Remove Squid footer completely

You can remove footer from squid error pages. Removing the version number from the footer is very easy.

In squid.conf enable
httpd_suppress_version_string

But what if you want to remove the whole message.
Generated Thu, 08 Jun 2000 06:58:30 GMT by proxy1.proxy.com (Squid/2.3.STABLE1)
There is no configuration available to remove it but you can always edit the source file for that. Don't worry its very easy. Easy because its really easy.

Just follow the following steps:
  1. Go to squid source. /usr/src/squid/src
  2. Backup the existing file errorpage.c cp ./errorpage.c ./errorpage.c.bkp
  3. Remove errorpage.o rm errorpage.o
  4. Edit the file errorpage.c vim errorpage.c
    {
    ERR_SQUID_SIGNATURE,
    "\n<\BR clear=\"all\">\n"
    "<\HR noshade size=\"1px\">\n"
    "
    \n"
    "Generated %T by %h (%s)\n"
    "
    \n"
    "<\/BODY><\/HTML>\n"
    }
  5. Remove the line "Generated %T by %h (%s)\n"
  6. Save and exit :wq
  7. Reconfigure squid with old options ./configure .........
  8. Make clean make clean
  9. Make make
  10. Make all make all
  11. Make install make install
  12. Stop squid /usr/local/squid/sbin/squid -k shutdown
  13. Start squid /usr/local/squid/sbin

Chip In A Dollar Or Two, Will You?

Paypal:

20 comments:

  1. I usually remove squid error footer by adding &gt!-- Generated %T by %h (%s)--&lt
    to the end of line from ERR_ACCESS_DENIED file

    ReplyDelete
  2. You are commenting the line. So the result will be the same.

    ReplyDelete
  3. *lol*
    And no one will look at the source of the page?

    ReplyDelete
  4. THERE IS A WAY without messed up with the source code,especially for you that install squid with aptitude or synaptic things.

    Just add in the end of the line of ERR_ACCESS_DENIED this applied to other error message.

    thanks for momonsolommon very inspiring

    ReplyDelete
  5. THERE IS A WAY without messed up with the source code,especially for you that install squid with aptitude or synaptic things.

    Just add (without qoute) in the end of the line of ERR_ACCESS_DENIED this applied to other error message.

    thanks for momonsolommon very inspiring

    ReplyDelete
  6. May you explain a little bit more what to add please ?
    Right now, the squid error footer doesn't appear in the page, but it is visible as a comment in the page source code.

    ReplyDelete
  7. Hi Anonymous, he means to do,

    <!-- Generated %T by %h (%s)-->

    Noticed the <!-- and --> ?

    ReplyDelete
  8. It's only a solution to put the entry in comment and not show it in the web page.
    But this entry is still available in the page source code. I obtain this :
    !--Generated Tue, 12 Oct 2010 10:04:07 GMT by Server (squid)--

    So every body knows you are using Squid !
    I am looking for a full solution whithout modifying the Squid sources and a new compilation...

    ReplyDelete
  9. try using " & l t ; " and " & g t ; " without the space and quotes for < and > sign.

    ReplyDelete
  10. Still not OK...
    Can you confirm you don't have anything in your source page ? I am using Squid2.7 stable7.
    Where do you add the < !-- Generated %T by %h (%s)-- > in the file ? After the < /body >?

    Maybe you can send me the ERR_ACCESS_DENIED file you are using for exemple in order to test it ? (arno_2003 at yahoo dot fr)
    Thx

    ReplyDelete
  11. Hi, I'm just elaborating the point "momonsolommon" said.

    ReplyDelete
  12. I'm running squid on Debian Lenny,
    usually I edit ERR_ACCESS_DENIED file with nano,
    nano /usr/share/squid/errors/English/ERR_ACCESS_DENIED
    at the end of the file there's a line:
    Generated %T by %h (%s)
    changes to:
    <-- Generated %T by %h (%s) -->

    ReplyDelete
  13. is a simpler method: edit a binary file generated from the conversion of a string ... a corresponding removal of this value ie the amount of space - I recommend "mcedit squid;)

    ... and for that you delete the contents of files / usr / share / squid / errors / En / *
    There is an error in the case of large squid die - we make a copy

    ReplyDelete
  14. So what have i done wrong?
    this -> <-- Generated %T by %h (%s) -->
    produces 2 of the footers.

    this -> < !-- Generated %T by %h (%s)-- >
    does the same thing.

    i found 'httpd_suppress_version_string off' in the config file,

    it change nothing.


    someone above say theres a version string at the end of the error files, but i dont see it.


    i dont really want to re-complie squid, it was yum installed..

    when i search google for 'remove squid footer' i get redirected ONLY to this webpage, f... google has gone s.i*.

    ReplyDelete
  15. Hi anonymous, you must compile Squid if you want to completely remove the footer.

    ReplyDelete
  16. If you want to remove it yet, compiling is the easiest way... But if you just want to make it disappear you can do that much easier, all you need is the following text in a custom error page (it will make the hr and the footer text transparent). *argh it doesn't want to accept the code so execute this script to get the code :-(

    echo '1TITLE21/TITLE21STYLE type=5text/css521344hr{opacity807filter8alpha$opacity60%7}address{opacity807filter8alpha$opacity60%7}1/STYLE21/HEAD21BODY2' | tr '12345678$%' '<>!-"=;:()'

    ReplyDelete
  17. Correction - got a little overzealous with the substitutions... this will work! :-) 1 and 2 map to < and > respectively

    echo '1TITLE21/TITLE21STYLE type="text/css"21!--hr{opacity:0;filter:alpha(opacity=0);}address{opacity:0;filter:alpha(opacity=0);}1/STYLE21/HEAD21BODY2' | tr '12' '<>'

    ReplyDelete
  18. or simply add this css code on your error page between the STYLE directives:

    ...

    address {
    display: none;
    }
    hr {
    display: none;
    }

    ...

    ReplyDelete