# Serving images with IIRF?

 Topics: Developer Forum Wiki Link: [discussion:37705]
 robwala Oct 14, 2008 at 5:23 PM I am wondering if IIRF can be used for the following scenario: I have several development machines, all running a test website. Each of these websites needs access to a large image directory which I would like to place on another server. Can I use IIRF to rewrite requests for   \images\image1.jpg to   http:\\server2\images\image1.jpg ?? I am testing with the following rule: RewriteRule ^/images/(.*)$http://dev.server2.com/images/$1 [L,I] which seems to be doing the proper replacing, but I do not get any of the images returned from server2. Partial log follows: Tue Oct 14 11:20:24 2008 - DoRewrites Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree: getting 'url' Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree - no joy (GetLastError()=1413) Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree: 128 bytes Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree: result '' Tue Oct 14 11:20:24 2008 - GetHeader_AutoFree: getting 'url' Tue Oct 14 11:20:24 2008 - GetHeader_AutoFree: 22 bytes Tue Oct 14 11:20:24 2008 - GetHeader_AutoFree: result '/images/dot_clear.gif' Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree: getting 'QUERY_STRING' Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree: 1 bytes Tue Oct 14 11:20:24 2008 - GetServerVariable_AutoFree: result '' Tue Oct 14 11:20:24 2008 - GetHeader_AutoFree: getting 'method' Tue Oct 14 11:20:24 2008 - GetHeader_AutoFree: 4 bytes Tue Oct 14 11:20:24 2008 - GetHeader_AutoFree: result 'GET' Tue Oct 14 11:20:24 2008 - DoRewrites: New Url: '/images/dot_clear.gif' Tue Oct 14 11:20:24 2008 - ApplyRules: depth=0 Tue Oct 14 11:20:24 2008 - ApplyRules: Rule 1 : 2 matches Tue Oct 14 11:20:24 2008 - ReplaceServerVariables: InputString='http://dev.server2.com/images/$1' out='http://dev.server2.com/images/$1' Tue Oct 14 11:20:24 2008 - GenerateReplacementString: src='/images/dot_clear.gif','(null)' ReplacePattern='http://dev.server2.com/images/$1' vec=[[ 0, 21, 8, 21] [] ] counts=2,0 Tue Oct 14 11:20:24 2008 - GenerateReplacementString: replacing ($1) with 'dot_clear.gif' Tue Oct 14 11:20:24 2008 - ApplyCaseConversion: before 'http://dev.server2.com/images/dot_clear.gif' Tue Oct 14 11:20:24 2008 - ApplyCaseConversion: after  'http://dev.server2.com/images/dot_clear.gif' Tue Oct 14 11:20:24 2008 - GenerateReplacementString: result 'http://dev.server2.com/images/dot_clear.gif' Tue Oct 14 11:20:24 2008 - ApplyRules: Result (length 50): http://dev.server2.com/images/dot_clear.gif Tue Oct 14 11:20:24 2008 - ApplyRules: Last if Match Tue Oct 14 11:20:24 2008 - ApplyRules: returning 1 Tue Oct 14 11:20:24 2008 - DoRewrites: Rewrite Url to: 'http://dev.server2.com/images/dot_clear.gif' Tue Oct 14 11:20:24 2008 - DoRewrites: not recording OriginalUrl (0x01272c98) Tue Oct 14 11:20:24 2008 - DoRewrites: Finished Tue Oct 14 11:20:24 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP Tue Oct 14 11:20:24 2008 - OnUrlMap: storing physical path (C:\inetpub\dfs\images\dot_clear.gif), in ptr (0x0126e5f8) Cheeso Coordinator Oct 14, 2008 at 6:47 PM You can redirect, but not rewrite, to a resource on another server.  You need to use the [R] flag. Check the readme to understand the distinction. What do your rules look like? robwala Oct 14, 2008 at 7:10 PM Such a simple solution :)  I was under the (mistaken) impression that using the [R] flag would actually redirect my browser to the first redirected url it ran across..  so now I just have RewriteRule ^/images/(.*)$http://dev.imageserver.com/images/$1 [R] and my images are all coming across just fine - Thanks! Cheeso Coordinator Oct 14, 2008 at 7:45 PM The [R] flag does redirect your browser. I don't know what you mean by "the first URL it ran across". But whatever, I'm glad it's working for you.