Max length of url

Jan 14, 2010 at 2:44 PM

Hi

what is the max length of the URL

I have the rules

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]

the url "/img/content/recipes/roast-chicken/featured_image.jpg" does not rewrite because the file exist. this should happen.

the url "/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/featured_image.jpg" does rewrite and the file does exist. this should not happen

Thanks for your help

 

Jan 14, 2010 at 2:54 PM

these are in the same directory

 

the url "/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/image.jpg" does not rewrite because the file exist. this should happen.

the url "/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/featured_image.jpg" does rewrite and the file does exist. this should not happen

Coordinator
Jan 14, 2010 at 7:26 PM

It's not a problem with the max length of a URL.  I think that number is set to 1024 in the code. In any case you are not bumping into it.  There was also a problem with REQUEST_FILENAME being able to support only 128 characters.  I've fixed that too, but in your case, once again, you are well under than limit. So that is also not the problem.

Is it possible the file in question has an ACL that makes it unreadable by IIS?

I recommend that you compare the ACLs for the images that work correctly, versus the images that don't work correctly.

I just tried this here and I can reproduce the problem if I remove IIS_IUSRS from the ACL for the image.  If I restore that ACL entry, then the image is displayed properly again.

This is on Windows Vista (IIS7).  The principal in your case will be different if you're on a different OS. 

 

Jan 15, 2010 at 10:25 AM

I have checked the ACL and all are the same

when I change the featured_image.jpg file name to featur.jpg it works (/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/featur.jpg)

I am using IIS6 on windows 2003

I have added the condition "RewriteCond %{HTTP_URL} !(/|\.jpg)$" not to rewrite if it is jpg. It will have to do for now

Thanks for your help

Coordinator
Jan 15, 2010 at 5:32 PM
Edited Jan 18, 2010 at 1:18 PM

Glad its working.

If the behavior is reproducible, I'd like to see an IIRF log that shows the Image being incorrectly rewritten (the part that should not happen as you described it above).

Jan 18, 2010 at 6:31 AM

Hi

Here is the log

 

Fri Jan 15 11:11:44 -  3972 - DoRewrites: Url (no decoding): '/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/featured_image.jpg'
Fri Jan 15 11:11:44 -  3972 - EvaluateRules: depth=0
Fri Jan 15 11:11:44 -  3972 - EvaluateRules: Rule 1 : 2 matches
Fri Jan 15 11:11:44 -  3972 - EvalCondition: Cond %{REQUEST_FILENAME} !-f => TRUE   ------------- Should be false
Fri Jan 15 11:11:44 -  3972 - EvalCondition: Cond %{REQUEST_FILENAME} !-d => TRUE
Fri Jan 15 11:11:44 -  3972 - EvalConditionList: rule 1, TRUE, Rule will apply
Fri Jan 15 11:11:44 -  3972 - EvaluateRules: Result (length 99): /index.php?url=/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/featured_image.jpg
Fri Jan 15 11:11:44 -  3972 - EvaluateRules: Last Rule
Fri Jan 15 11:11:44 -  3972 - EvaluateRules: returning 1
Fri Jan 15 11:11:44 -  3972 - DoRewrites: Rewrite Url to: '/index.php?url=/img/content/recipes/roast-chicken-with-tangy-mayonnaise-sandwich/featured_image.jpg'
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:44 -  3972 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:46 -  1872 - HttpFilterProc: SF_NOTIFY_LOG
Fri Jan 15 11:11:46 -  3972 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:46 -  3972 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:46 -  3972 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Jan 15 11:11:46 -  3972 - DoRewrites
Fri Jan 15 11:11:46 -  3972 - DoRewrites: Url (no decoding): '/js/jquery.animate.clip.js'
Fri Jan 15 11:11:46 -  3972 - EvaluateRules: depth=0
Fri Jan 15 11:11:46 -  3972 - EvaluateRules: Rule 1 : 2 matches
Fri Jan 15 11:11:46 -  3972 - EvalCondition: Cond %{REQUEST_FILENAME} !-f => FALSE
Fri Jan 15 11:11:46 -  3972 - EvalConditionList: rule 1, FALSE, Rule does not apply
Fri Jan 15 11:11:46 -  3972 - EvaluateRules: returning 0
Fri Jan 15 11:11:46 -  3972 - DoRewrites: No Rewrite
Fri Jan 15 11:11:46 -  4048 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Jan 15 11:11:46 -  4048 - HttpFilterProc: cfg= 0x01294248
Fri Jan 15 11:11:46 -  4048 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE