You can actually install an Apache HTTP server on your computer, make it into a forward proxy, and then use the caching capabilities to save traffic.
How to configure forward proxy here is not much to say, on the internet to catch a lot. Here, there are a lot of sites do not specify the picture,. Js/.css in the user's browser to cache one end of time, in these sites to switch multiple pages, will produce a lot of repetitive traffic.
We can reasonably assume that the picture of the site, the. js/.css file, will not change over a period of time. So we can configure Apache to modify the images of these sites, the. js/.css file cache time, and avoid duplicate transmission of the same file.
The configuration method is simple, in httpd.conf, open mod_headers, Mod_mem_cache, Mod_cache, Mod_file_cache, plus the following configuration:
Copy Code code as follows:
#local forward Proxy Server
Listen 5081
Include conf/extra/httpd-vhosts-5081.conf
Create a new text file, httpd-vhosts-5081.conf, in the conf/extra/directory (Windows version Apache). In this file, plus such a configuration (picture file cache 365 days, JS/CSS cache 1 hours):
Copy Code code as follows:
#local forward Proxy Server
Namevirtualhost *:5081
#local forward Proxy Server
<virtualhost *:5081>
Proxyrequests on
Proxyvia on
<locationmatch "\. (JS|CSS) $ ">
Header unset P3P
Header unset Cache-control
Header unset Expires
Header unset Pragma
Header unset ETag
Fileetag None
#cache 1 hour
Header set Cache-control "max-age=3600, public"
</LocationMatch>
<locationmatch "\. (gif|jpe?g|png) $ ">
Header unset P3P
Header unset Cache-control
Header unset Expires
Header unset Pragma
Header unset ETag
Fileetag None
#cache 365 days
Header set Cache-control "max-age=31536000, public"
</LocationMatch>
</VirtualHost>
Of course, you can also adjust the time parameter here, in seconds. You can use the excel/calculator to calculate the desired number of seconds in advance.