Solution for high varnish back-to-source traffic caused by cookies

Source: Internet
Author: User
Tags varnish

Today, when you look at the varnish upper-level Source traffic, we find that the traffic is much larger than usual. At this time, you need to calmly think about the problem and see how small series solves it.

  1. View the traffic diagram of zabbix, and find that the bandwidth is significantly increased by several hundred MB.
  2. Go to the CDN node and run the varnishlog-I txurl command to check which URLs cause back-to-source. It is found that the origin is always returned because of cookies. The solution is as follows:

3. Add the following in the varnish configuration file:

# Remove Cookies and query strings (static files do not usually need to process Cookies and QueryStrings)

If (req. url ~ "^/[^?] + \. (F3d | jpg | png )(\?. * |) $ ")

Unset req. http. cookie;

Set req. url = regsub (req. url, "\?. * $ "," ");

}

View the zabbix traffic diagram again. The traffic is down.

Conclusion: You can view the Back-to-source traffic diagram later. If the url cannot be hit, or you MISS it in a few minutes after hit, you can add a suffix to it to solve the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.