<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Need a lightTPD guru!</title>
	<link>http://ask.metafilter.com/32760/Need-a-lightTPD-guru/</link>
	<description>Comments on Ask MetaFilter post Need a lightTPD guru!</description>
	<pubDate>Thu, 16 Feb 2006 19:25:03 -0800</pubDate>
	<lastBuildDate>Thu, 16 Feb 2006 19:25:03 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Need a lightTPD guru!</title>
		<link>http://ask.metafilter.com/32760/Need-a-lightTPD-guru</link>	
		<description>Moving from Apache to lightTPD and I&apos;m having trouble with RewriteCond and RewriteRule. &lt;br /&gt;&lt;br /&gt; I&apos;ve got the following RewriteCond and RewriteRule lines in Apache on a working Rails application. I&apos;ve successfully moved the app over to LightTPD except for these rewrites for a specific part of the application. &lt;br&gt;
&lt;br&gt;
I&apos;m not terribly good with Apache&apos;s use of these either, so I&apos;m hoping someone will take pity on me and help get this done. I&apos;ve tried getting help on it from the #lighttpd IRC channel without success, because no one I&apos;ve talked to seems to know how this would be done.&lt;br&gt;
&lt;br&gt;
Help me, MeFI Wan, you&apos;re my only hope!&lt;br&gt;
&lt;pre&gt;&lt;br&gt;
RewriteEngine On&lt;br&gt;
# put authorization details in our header&lt;br&gt;
RewriteCond %{REQUEST_URI} ^/blah-api/&lt;br&gt;
RewriteRule /(.*) - [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br&gt;
# put request REST path into another header&lt;br&gt;
RewriteCond %{REQUEST_URI} ^/blah-api/&lt;br&gt;
RewriteCond %{REQUEST_URI} !^/blah-api/api-dispatch.cgi&lt;br&gt;
RewriteRule /jobtips-api/(.*)$ /blah-api/api-dispatch.cgi [E=X-BLAH_RESOURCE:$1,PT]&lt;br&gt;
&lt;/pre&gt;&lt;br&gt;
In the event someone solves this completely with their response, I will donate $10 to their favourite charity. I really need this to work.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.32760</guid>
		<pubDate>Thu, 16 Feb 2006 12:27:39 -0800</pubDate>
		<dc:creator>Kickstart70</dc:creator>
		
			<category>lighttpd</category>
		
			<category>apache</category>
		
			<category>rewrites</category>
		
	</item> <item>
		<title>By: mendel</title>
		<link>http://ask.metafilter.com/32760/Need-a-lightTPD-guru#511873</link>	
		<description>I haven&apos;t used lighttpd, but this seemed interesting. I read through the source of lighttpd&apos;s mod_rewrite module and there&apos;s nothing there that uses environment variables, so if it&apos;s possible to do what you want at all in lighttpd, it&apos;s not done with mod_rewrite. &lt;br&gt;
&lt;br&gt;
If it&apos;s your own app, I&apos;d recommend porting the &lt;i&gt;app&lt;/i&gt; to lighttpd, &lt;i&gt;not&lt;/i&gt; the Apache rewrite rules. &lt;br&gt;
&lt;br&gt;
It&apos;s a bit hackish that that uses mod_rewrite in Apache the first place; you&apos;re &lt;i&gt;not rewriting URLs&lt;/i&gt;, after all, you&apos;re filling the environment based on their content. But the reason for that hack is that Apache prevents you from accessing HTTP auth info in the environment in the first place.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.bigbold.com/snippets/posts/show/806&quot;&gt;This code snippet&lt;/a&gt; looks as though lighttpd simply doesn&apos;t require the workaround; you should be able to use the HTTP_AUTHENTICATION environment variable without having to populate it yourself. (Note that there&apos;s no &quot;X_&quot; there.)&lt;br&gt;
&lt;br&gt;
Your second recipe ought to be easy; the full request path should be in REQUEST_URI in the environment to begin with, and you can trim out the constant in your app instead of having mod_rewrite do it. Based on that other snippet (I don&apos;t know much ruby, and even less rails, and still less lighttpd), something like&lt;br&gt;
&lt;pre&gt;@request.env[&quot;REQUEST_URI&quot;].scan(/^\/jobtips-api\/(.*)$/i).to_s&lt;/pre&gt;&lt;br&gt;
One thing you might find handy is to write a little app that just goes through each element of @request.env and prints out its name and value; that way you can find out empirically if what you need is in the environment.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.32760-511873</guid>
		<pubDate>Thu, 16 Feb 2006 19:25:03 -0800</pubDate>
		<dc:creator>mendel</dc:creator>
	</item>
	</channel>
</rss>
