It sounds like you're running a local web server. Excellent.
In your Mac's filesystem, there is a file called
/etc/hosts. You can redirect all requests for
fooCDN.com to your local machine by adding this line in
127.0.0.1 foocdn.com www.foocdn.com
You will need root (super user) permissions to edit
The above line means that
fooCDN.com will load from your own computer, where a web server is listening.
You didn't specify what web server you're running locally, though. Following the web server's documentation, you should create a virtual host that points the document root of
This is a sample configuration (I haven't tested it myself) you can try to use with Apache:
Here's a sample configuration for Nginx (also untested):
Don't forget to restart the you web server service or reload the new configuration file.