Rackspace Cloud rewrite jpg causes Session reset
Posted
by willoller
on Stack Overflow
See other posts from Stack Overflow
or by willoller
Published on 2010-04-23T15:36:10Z
Indexed on
2010/05/01
0:07 UTC
Read the original article
Hit count: 294
This may be the .Net version of this question.
I have an image script with the following:
...
Response.WriteFile(filename);
Response.End();
I am rewriting .jpg files using the following rewrite rule in web.config:
<rule name="Image Redirect" stopProcessing="true">
<match url="^product-images/(.*).jpg" />
<conditions>
<add input="{REQUEST_URI}" pattern="\.(jp?g|JP?G)$" />
</conditions>
<action type="Redirect" redirectType="SeeOther" url="/product-images/ProductImage.aspx?path=product-images/{tolower:{R:1}}.jpg" />
</rule>
It basically just rewrites the image path into a query parameter.
The problem is that (intermittently of course) Mosso returns a new Asp Session cookie which breaks the whole world.
- Directly accessing a static .jpg file does not cause this problem.
- Directly accessing the image script does not cause it either.
- Only rewriting a .jpg file to the .aspx script causes the Session loss.
Things I have tried
(From the Rackspace doc How can I bypass the cache?)
I added Private cacheability to the image script itself:
Response.Cache.SetCacheability(HttpCacheability.Private);
I tried adding these cache-disabling nodes to web.config:
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
and
<httpProtocol>
<customHeaders>
<add name="Cache-Control private" value="Cache-Control private"
</customHeaders>
</httpProtocol>
The Solution I need
The browser cache cannot be disabled. This means potential solutions involving Cache.SetNoStore()
or HttpCacheability.NoCache
will not work.
© Stack Overflow or respective owner