<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc=" http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>briancarper.net (λ) (Tag: Apache)</title><link>http://briancarper.net/tag/87/apache</link><description>Some guy's blog about programming and Linux and cows.</description><item><title>Fun with HTTP headers</title><link>http://briancarper.net/blog/fun-with-http-headers</link><guid>http://briancarper.net/blog/fun-with-http-headers</guid><pubDate>Tue, 17 Mar 2009 22:14:10 -0700</pubDate><description>&lt;p&gt;One fun thing about playing with Compojure is that it doesn't do much with HTTP headers for you, which is a good learning opportunity.  &lt;a href=&quot;http://tools.ietf.org/html/rfc2616&quot;&gt;RFC 2616&lt;/a&gt; is rather helpful here.&lt;/p&gt;

&lt;p&gt;For example I learned that if you don't set a &lt;code&gt;Cache-Control&lt;/code&gt; or &lt;code&gt;Expires&lt;/code&gt; header, your browser will happily re-fetch files over and over, which is a bit of performance hit.  Static files that don't change often like images etc. can be set with a higher &lt;code&gt;Expires&lt;/code&gt; value so they're cached.&lt;/p&gt;

&lt;p&gt;Another thing to keep in mind (note to self) is that using &lt;a href=&quot;http://httpd.apache.org/docs/2.0/mod/mod_proxy.html&quot;&gt;mod_proxy&lt;/a&gt; to forward traffic to a local Jetty server means that the &quot;remote IP&quot; you get from &lt;code&gt;(.getRemoteAddr request)&lt;/code&gt; will always be &lt;code&gt;127.0.0.1&lt;/code&gt;.  If you want the user's real remote IP, you have to look in the &lt;code&gt;X-Forwarded-For&lt;/code&gt; header (easily accessed as &lt;code&gt;(:x-forwarded-for headers)&lt;/code&gt; in Compojure.  Given that &lt;a href=&quot;http://en.wikipedia.org/wiki/Identicon&quot;&gt;Identicons&lt;/a&gt; are generated from a hash of an IP address, this has resulted in some screwed up (wrongly identical) avatars for a bunch of people in posts for the past couple days.  Oops.  Not much I can do to fix that now.&lt;/p&gt;

&lt;p&gt;In other non-news, I just the spam logging for the blog so I can see the kinds of things bots are doing to get around my feeble anti-spam measures.  Sadly the spam seems to have stopped entirely, right after I set this up.  How annoying.&lt;/p&gt;</description></item></channel></rss>

