In fact, you can install an Apache HTTP server on your computer, prepare it as a forward proxy, and then use the cache function to save traffic.
How to configure the forward proxy is not mentioned here. Catch the forward Command on the net. Many websites do not explicitly specify images or images ,. js /. css caches one end of time in your browser. switching between multiple pages of these websites will produce a lot of repeated traffic.
We can reasonably assume that the website images and. js/. css files will not change for a while. Therefore, we can configure Apache to modify the cache time of images and. js/. css files of these websites to avoid repeated transmission of the same files.
The configuration method is simple. In httpd. conf, open mod_headers, mod_mem_cache, mod_cache, mod_file_cache, and add the following Configuration:Copy codeThe Code is 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 apache ). Add this configuration to this file (image files are cached for 365 days, and js/css files are cached for 1 hour ):
Copy codeThe Code is 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 an Excel/calculator to calculate the required number of seconds in advance.