24 April 2014

Catatan Seputar Squid



1. Membelokkan semua request ke proxy lain :

cache_peer parentcache.foo.com parent 3128 0 no-query default
never_direct allow all


Dengan config ini, jika parent cache gagal atau tidak merespon, maka semua request akan menampilkan pesan error.
Jika kita ingin membolehkan untuk menggunakan direct connection ketika parent proxy down kita bisa menggunakan pendekatan :

cache_peer parentcache.foo.com parent 3128 0 no-query
prefer_direct off
nonhierarchical_direct off


Perintah prefer_direct off  memerintahkan Squid untuk mencoba request pertama ke parent.

2. Membelokkan request domain tertentu saja

cache_peer parentcache1.foo.com parent 3128 3130
cache_peer parentcache2.foo.net parent 3128 3130
cache_peer parentcache3.foo.com sibling 3128 3130
cache_peer parentcache4.foo.net sibling 3128 3130
cache_peer_domain parentcache1.foo.com .google.com .yahoo.com
cache_peer_domain parentcache2.foo.net .vimeo.com .youtube.com
cache_peer_domain parentcache3.foo.com .id .go.id .web.id .co.id
cache_peer_domain parentcache4.foo.net   .uk .de .fr .no .se .it


Jika tidak menggunakan cache_peer bisa menggunakan directive :
acl INSIDE dstdomain .mydomain.com
always_direct allow INSIDE
never_direct allow all


Maka INSIDE akan selalu dibelokkan ke mydomain.com sedang yang lainnya direct.
Atau menggunakan IP internal dengan directive :
acl INSIDE_IP dst 192.168.0.1/24
always_direct allow INSIDE_IP
never_direct allow all


Contoh lain dari always_direct access list.
Misal, Jika kita ingin squid agar connect secara direct ke hotmail.com server, kita bisa menggunakan perintah berikut di config file:
acl hotmail dstdomain .hotmail.com
always_direct allow hotmail


3. Anonymizer

Jika kita memilih untuk menggunakan anonymizer kita harus memberi perintah opsi forwarded_for untuk mencegah client terungkapkan. Lupa untuk mematikan opsi forwarded_for akan mengurangi efektifitas dari anonymizer. Terakhir jika kita memfilter User-Agent header menggunakan opsi fake_user_agent dapat mencegah masalah beberapa user sebagaimana beberapa situs membutuhkan User-Agent header.
NB: Squid harus di built dengan konfigurasi --enable-http-violations sebelum di build.
Squid 2.6 - 2.7
Membolehkan penghapusan atau penggatian header tertentu melalui opsi http_header_access dan header_replace.
Squid 3.0
Membolehkan penghapusan atau penggantian selektif dari header spesifik di dalam request atau reply dengan request_header_access dan reply_header_access dan header_replace setting.
Squid 3.1
Menambah kemampuan 3.0 dengan pemotongan, penggantian, atau penghapusan header X-Forwarded-For-.


4. Squid Tanpa Cache

Kita bisa menggunakan squid sebagai proxy-only, tanpa membuat cache. Jadi tidak memberatkan dan mengurangi kapasitas harddisk.
Kita bisa menggunakan perintah cache access untuk membuat Squid tidak membuat cache setiap respon :
cache deny all
Pada Squid-2.7, Squid-3.1 dan sesudahnya kita juga dapat menghapus  semua opsi 'cache_dir' dari  squid.conf untuk mencegah pembuatan direktori cache.
Pada Squid-2.4, 2.5, 2.6, dan 3.0 kita perlu menggunakan "null" storage modul:
cache_dir null /tmp
Catatan: Perintah null cache_dir tidak mendisable caching, tapi tidak menyimpan atau membuat struktur cache. Directory (mis,/tmp) harus ada, jadi squid dapat chdir ke direktori tsb, Selain itu kita juga bisa menggunakan opsi coredump_dir .
Untuk konfigurasi Squid "null" storage modul, kita perlu meng-compile dengan command line:
--enable-storeio=null,...


5. Membatasi Besarnya File yang di Download
Kita bisa set secara global parameter reply_body_max_size. Opsi ini mengontrol besarnya HTTP message body yang akan dikirim ke cache client untuk satu request.
Jika batasan tercapai, maka secara otomatis koneksi ke klien akan terputus.
(!) Catatan: user-agents "buatan" ini akan tetap bisa men-download file besar melalui cache menggunakan HTTP/1.1 range requests.

To Be Continue ...

6 komentar:

  1. garcinia cambogia reviews I also believe
    that mesothelioma is a scarce form of cancer
    that is normally found in those previously subjected to asbestos.
    Cancerous tissue form in the mesothelium, which is a defensive
    lining which covers most of the body’s body organs.
    These cells generally form inside the lining of your lungs, tummy, or
    the sac that encircles the heart. Thanks for sharing your ideas.
    garcinia cambogia

    BalasHapus
  2. garcinia cambogia reviews Needed to write you one very little
    word to finally give many thanks the moment again for your personal extraordinary
    pointers you’ve documented in this article.
    It’s simply seriously open-handed of you to present publicly just what a few people could have
    advertised for an e-book to help make some dough for their
    own end, most importantly given that you might have done it if you ever wanted.
    Those inspiring ideas additionally worked to be the great way to know that most people
    have a similar interest just like my own to figure out way
    more with respect to this condition. I’m sure there are thousands of more pleasurable opportunities up front for individuals who discover your blog post.
    garcinia cambogia reviews

    BalasHapus
  3. If you are going for finest contents like myself, just pay a quick visit this web page everyday since it presents feature contents, thanks

    Also visit my web page: search engine optimization ()

    BalasHapus
  4. I am actually pleased to glance at this website posts which consists of lots
    of helpful information, thanks for providing these data.



    my web blog; seo (http://seofornown4eva.com)

    BalasHapus
  5. Press PLAY above to observe Stephen get his first shot
    at delivering the Prime Ten on the Late Present !



    Stop by my page herbal legal party pills

    BalasHapus
  6. Wonderful article! That is the type of info that
    should be shared around the internet. Shame on the search engines for now not positioning this submit higher!

    Come on over and seek advice from my web site . Thanks =)

    My blog :: nike free pas cher

    BalasHapus

Masalah Error Koneksi Printer via Jaringan Lokal

Sempat kelabakan ketika mau print via network setelah server diinstall ulang karena bermasalah. Semua setting sudan selesai dan hampir sama...