March 2011

HOW TO : Enable global reverse proxy with certain exclusions in Apache

Say you want to enable reverse proxy on a site powered by Apache Web Server where all traffic to the web site it reverse proxied to a different server, but you want to exclude certain paths from being reverse proxies. I don’t know why you would want to do that :).. but we ran into that scenario at work and I wanted to document the config for future reference. The picture below shows a high level view of the traffic

  • Ensure the following modules are being loaded in Apache.

[bash]

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

[/bash]

  • In the virtual host configuration for kudithipudi.org add the following lines

[bash]

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /static !
ProxyPass /media !
ProxyPass / http://INTERNAL_SERVER:8888
ProxyPassReverse / http://INTERNAL_SERVER:8888

[/bash]

HOW TO : Trick to find out your IP address from a web server farm

This is a quick trick I came up with to find out the IP address of a client that is trying to access a farm of web servers that you have access to. The diagram below shows the network path for a typical web server.

You have a client that might be sitting behind a (or multiple) proxy server. And there is a load balancer involved because you have multiple web servers for redundancy.

We were recently working on some rewrite rules for our web servers at work and we needed to find out what IP address the web servers were seeing the client traffic come from. Couple of challenges

  • Which web server do you check? The load balancer can send you traffic to any server.
  • What IP address are you going to look for? Wait that is the original problem right :).

The web servers usually write an entry to the error log when they serve a 404 error. So we can use that to figure out which web server you are hitting and what IP address the web server is seeing you as. Here’s the trick

  • On the client side go to http://WEBSITE_ADDRESS/Get_Me_My_IP (or some other URL, which you know doesn’t exist on the web site)
  • On the server side, grep for “Get_Me_My_IP” in the web server error logs

Here is an example, I ran on this website (https://kudithipudi.org)

[bash]
root@samurai:/var/log/apache2# grep -i what_is_my_ip access_kudithipudi.log
199.27.130.105 – – [04/Mar/2011:16:07:18 +0000] "GET /what_is_my_ip HTTP/1.0" 40 4 5495 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.14) Gecko/2 0110218 Firefox/3.6.14 ( .NET CLR 3.5.30729; .NET4.0E)"
[/bash]

  • From this entry I can figure out that my client is appearing as “199.27.130.105” to the web server.

RESOLUTIONS : 2011 : February Update

Here come the monthly updates on my 2011 resolutions.

  1. Lose the gut.
    • Continuting to follow the diet in Tim Ferri’s book. I seemed to have plateaued in February (between 185 – 187 lbs), so I kicked it up a notch with chemicals. OK.. no steriods. Just some good old garlic. Today, I weighed 183lbs!!.. That’s 11.5lbs in 2 months. Here’s a chart of my daily weight since 1/3/2011
    • I think the trick is to really keep the diet simple, so that you don’t have to worry about what you are eating. The 2 egg whites for breakfast is great. In March, I am planning on extending the “keep it simple” to lunch. Some beans and spinach are going to do wonders.
    • I also started practicing Yoga on weekends. This is another thing, once I get up to speed and more comfortable, I plan on doing every day.
    • My running distance is up to 4 miles now.. Up from a embarrassing 1 mile :). And this is the same guy that used to run Marathons :).
  2. Increase traffic to kudithipudi.org
    • I published 7 posts in Feb 2011. Not as many as I wanted, but the increase in traffic has been pretty impressive so far. Here is a snapshot of a Google Analytics report comparing the first two month periods of 2010 and 2011. (click on the image for a larger size. The blue line shows 2011 traffic and the green line shows 2010 traffic)
    • I still didn’t publish the posts I have been meaning to for sometime now 🙂
  3. CISSP Certification
    • No progress on this yet :(..
    • I did start the process to form a hacker group at work to discuss and brain storm new technologies. Not close to getting certification, but something to keep the mind busy.
  4. Vacation
    • Our trip to India is finalized. I even bought the tickets!! And we are going to fly through Abu Dhabi. How abt that for a 3 hour layover vacation 🙂 ?

Overheard : Comment about perception

Comment by Mark Horstman on his recent podcast regd managing a massive workload increase

We don’t see the world as it is, we see it as we are

I believe this a famous quote.. don’t know who the original author is. But wanted to note, since it is a pretty deep :).

I highly recommend Mark and his partner Mike’s podcast “Manager Tools” and “Career Tools” to every professional. Well worth the time.