Using Squid as Substitute for MTN SimpleServer

Been using the Pythonic SimpleServer which is cool, but I’ve got some issues with it; it tries to use up any available resource and sometimes have issues in sending cookie headers the right way. I’ve been using Squid some time ago but never thought of it serving this function, now i have tested and it works. Now do same! 🙂

  • Install Squid from your repo
    $ sudo apt-get install squid3

    Or

    $ sudo apt-get install squid

    If squid3 is not available in your repo

  • Change into this directory /etc/squid3 and edit squid.conf, look for
    http_access deny all

    Change to

    http_access allow all

    Goto the last line of the config file and paste these

    cache_peer 10.199.212.2 parent 8080 0 no-query no-digest
    never_direct allow all
    dns_v4_first on
    request_header_add Host web.blackberry.com

    cache_peer: This tells Squid to use a proxy to process a request, which we are using 10.199.212.2:8080 as proxy server here
    never_direct allow all: This sets Squid never to fallback to direct connection when proxy fails
    dns_v4_first: By default Squid first go for IPv6 which not everyone has, so this enforces it to first check for IPv4
    request_header_add: This option adds a custom header to the request Squid is sending to the proxy

  • Save the file, restart squid service
    $ sudo systemctl restart squid3

    Or

    $ sudo service squid3 restart

    now set your proxy host and port to 127.0.0.1:3128

Have fun! 🙂