- If you choose to let your traffic visit the HTTP version of your site, the proxy cache servers will serve content that has been stored on them. This is a useful feature to help improve site performance.
- If you are making updates to your site, you'll want to be sure that you flush any cached content that is sitting inside the proxy cache servers or your newly updated content can take up to ~2 hours to be visible. A script has been provided below, with instructions on how to install and use it to help automate flushing the cached content in the proxy cache servers.
- If you are interested in further assistance with this, please visit our office hours that are held every Tuesday from 1:00-2:30pm in FAC 30 or send an email to web@utexas.edu.
The following script is what we will be using to flush the proxy server's cached content. This file is located at /utweb/common/src/examples/clearcache.sh - Below the script are instructions for installing and using it.
#!/bin/sh # This file is managed by puppet # # Class: utweb_panel_scripts # Resource: File["/utweb/common/src/examples/clearcache.sh"] # Source: utweb_panel_scripts/files/clearcache.sh # # Example of automating the process of purging the HTTP proxy cache for # a UT Web content site. # # This assumes: # * the script is running on the UT Web panel server # * The script is being run as the UT Web site account # * the URL to purge is the site's main URL (utwNNNNN.utweb.utexas.edu) # * all sub-URL's of the main site should be purged as well ($site/*) # # Season to taste. # siteuser=`whoami` site=http://$siteuser.utweb.utexas.edu urlstopurge="$site" utweb_prod_balancers=" utweb-px-z1-p01.its.utexas.edu utweb-px-z1-p02.its.utexas.edu " for b in $utweb_prod_balancers; do id=`echo $b | sed s/.its.utexas.edu/_http/` for u in $urlstopurge ; do echo === $b $site curl -v \ --cookie "balancer_id=$id" \ -X PURGE \ -D - "$u/*" done done
From a SSH client (Windows) or Terminal (OS X) window, you will need to connect to your site account's home directory on the panel server via a SSH connection:
ssh <utw10NNNNN>@panel.utweb.utexas.edu
**NOTE: These next steps assume that you are still in your home directory and have not changed your working directory upon logging in.Copy the clearcache.sh file in to your site account's home directory: To do this, type the following in to your command line:
cp /utweb/common/src/examples/clearcache.sh clearcache.sh
- If you have vanity domains stamped on your site, then please follow these instructions to add those to the script; otherwise, proceed to step #8:
Type the following command in your command line to edit the clearcache script:
nano ~/clearcache.sh
This will bring up the nano text editor in your terminal window. From here, you will need to navigate the file with your keyboards arrow keys. Find the line that says urlstopurge="$site"
Once you have navigated to that line, put a space after $site and add the domains you have stamped with your site. Separate each entry you add with a space. If your site can be visited with www, please include that name as well.
- When you are finished adding your domains, press "Ctrl+o" on your keyboard. Nano will then repeat to you the file it is making these changes to. Press "Enter" on your keyboard to confirm the file and save your changes.
Now that the file is in your home directory (and your domains have been optionally added), we need to change the permissions of the script to be executable. To do this, type the following in to your command line:
chmod 770 ~/clearcache.sh
Now that the file is executable, run the script by typing the following in to your command line:
~/clearcache.sh
Real Output (no additional domains have been added to the script, so the cache is only being cleared for utw10373.utweb.utexas.edu):
=== utweb-px-z1-p01.its.utexas.edu http://utw10373.utweb.utexas.edu * About to connect() to utw10373.utweb.utexas.edu port 80 (#0) * Trying 128.83.21.174... connected * Connected to utw10373.utweb.utexas.edu (128.83.21.174) port 80 (#0) > PURGE /* HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4. > Host: utw10373.utweb.utexas.edu > Accept: */* > Cookie: balancer_id=utweb-px-z1-p01_http > < HTTP/1.1 204 No Content HTTP/1.1 204 No Content < Server: nginx Server: nginx < Date: Wed, 27 Apr 2016 17:55:41 GMT Date: Wed, 27 Apr 2016 17:55:41 GMT < X-CacheServer: 172.17.99.42 X-CacheServer: 172.17.99.42 < Set-Cookie: balancer_id=utweb-px-z1-p01_http|VyD9I|VyD9I; path=/ Set-Cookie: balancer_id=utweb-px-z1-p01_http|VyD9I|VyD9I; path=/ < * Connection #0 to host utw10373.utweb.utexas.edu left intact * Closing connection #0 === utweb-px-z1-p02.its.utexas.edu http://utw10373.utweb.utexas.edu * About to connect() to utw10373.utweb.utexas.edu port 80 (#0) * Trying 128.83.21.174... connected * Connected to utw10373.utweb.utexas.edu (128.83.21.174) port 80 (#0) > PURGE /* HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: utw10373.utweb.utexas.edu > Accept: */* > Cookie: balancer_id=utweb-px-z1-p02_http > < HTTP/1.1 204 No Content HTTP/1.1 204 No Content < Server: nginx Server: nginx < Date: Wed, 27 Apr 2016 17:55:41 GMT Date: Wed, 27 Apr 2016 17:55:41 GMT < X-CacheServer: 172.17.99.43 X-CacheServer: 172.17.99.43 < Set-Cookie: balancer_id=utweb-px-z1-p02_http|VyD9I|VyD9I; path=/ Set-Cookie: balancer_id=utweb-px-z1-p02_http|VyD9I|VyD9I; path=/ < * Connection #0 to host utw10373.utweb.utexas.edu left intact * Closing connection #0
Check to see if the proxy caches were flushed by typing this in to your command line:
curl -vI utwNNNNN.utweb.utexas.edu OR curl -vI <your domain here>
Real Output:
* About to connect() to utw10373.utweb.utexas.edu port 80 (#0) * Trying 128.83.21.174... connected * Connected to utw10373.utweb.utexas.edu (128.83.21.174) port 80 (#0) > HEAD / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: utw10373.utweb.utexas.edu > Accept: */* > < HTTP/1.1 200 OK HTTP/1.1 200 OK < Server: nginx Server: nginx < Date: Wed, 27 Apr 2016 17:45:56 GMT Date: Wed, 27 Apr 2016 17:45:56 GMT < Content-Type: text/html; charset=UTF-8 Content-Type: text/html; charset=UTF-8 < Content-Length: 19 Content-Length: 19 < Set-Cookie: cache_id=36e1dd7a55420bbdaed5922d061460e7; expires=Wed, 27-Apr-16 18:45:56 GMT; path=/ Set-Cookie: cache_id=36e1dd7a55420bbdaed5922d061460e7; expires=Wed, 27-Apr-16 18:45:56 GMT; path=/ < Last-Modified: Wed, 27 Apr 2016 16:58:09 GMT Last-Modified: Wed, 27 Apr 2016 16:58:09 GMT < ETag: "abdfdae70c71675e-13-5317a507b7971" ETag: "abdfdae70c71675e-13-5317a507b7971" < X-BackendServer: 172.17.99.35:80 X-BackendServer: 172.17.99.35:80 < X-CacheServer: 172.17.99.43 X-CacheServer: 172.17.99.43 < X-Cache: MISS X-Cache: MISS < Accept-Ranges: bytes Accept-Ranges: bytes < Set-Cookie: balancer_id=utweb-px-z1-p02_http|VyD61|VyD61; path=/ Set-Cookie: balancer_id=utweb-px-z1-p02_http|VyD61|VyD61; path=/ < Cache-control: private Cache-control: private < * Connection #0 to host utw10373.utweb.utexas.edu left intact * Closing connection #0
Pay attention to the bottom of the output where you will see something like this to confirm the cache was flushed on that proxy cache server:
< X-Cache: MISS X-Cache: MISS
Check your site for updated content!