Mongrel response status Not Modified on headers change.
Mongrel returns Not Modified response status if there was some changes in the headers of the page.
For instance: I 've changed the Content-Type in order to fix a bug on browser side. But browser didn't manage to resolve that change. It is strange that firefox doesn't have any problems and detects the header change. But webkit inspector shows old headers values in inspector. Maybe it is the WebKit bug or Rails bug.
But anyway I think that server should set response status to 200 in case when headers were changed.
Please, check if that could be a Mongrel related issue.
Hello,
If this a Mongrel thing, can you create a simple Handler (as described in the docs) to recreate the issue?
If is Rails, how you started Rails server? with script/server or mongrel_rails?
A simplified example with code and real output will help us faster pinpoint and replicate this issue.
Please add this to the ticket and we will confirm and prioritize
Thank you.
Launching with mongrel_rails cluster::start
class SampleController < AppController def show if crazy_condition response['Content-Type'] = 'text/javascript' else response['Content-Type'] = 'text/html' end render :text => 'Hello' # assume response body is same in both cases. end end
See that in example above response text is the same but header is different. First of all we do the request and crazy_condition is true: 200 Ok Then we do the request 2nd time and crazy_condition is false: 304 Not modified
Body was not modified in fact but the header was changed.
How do you think is that correct?
Checked with webrick - not recreatable.
The following is the output of my test:
http://gist.github.com/354373
using script/server, using webrick, mongrel and thin. Also used mongrel and thin directly
I couldn't reproduce the 304 not modified.
Are you sure that there is no caching or anything interfering?
I was testing in Chrome. Possibly related to webkit. I will try on my own. Thanks anyway.
Hmn, the thing is that it might be possible the browser is not telling you the truth.
Can you test with Firefox and FireBug enabled? or basic curl calls, just to try that out.
It is kind of awkward that you're the first one reporting such issue.
Why did you close it?
Yes, I was to quick when I closed it.
Can you take a look at this: http://www.ubuntu-pics.de/bild/50414/screenshot_002_m3fKcc.png
Here you can see the result of ajax request I made second time after adding content type setter: Content-Type: javascript
Rails console says: 200 OK. Browser says 304 Not Modified and Content-Type is 'html'.
Do you have any ideas of how that might happen?
Seems is an Ajax request, not an normal HTTP one.
So that means is not a response to normal html. Can you tell me specifically which version of Rails are you using?
Also, if you're running in development or production mode and more details of the request (a get request using Prototype? Jquery?)
Thank you.
Rails 2.3.5 Development mode. Request generated using MooTools 1.2.4
Hello,
I've tried to replicate your scenario several times without success. Of course, always testing a single server and not cluster version.
If you can provide a simple rails app in a GitHub repository that I can clone and test out, will be great.
Going to set this on feedback until you can provide that.
Thank you.