-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
h2o returns 304 instead of 200 in connection with php-fpm #1375
Comments
I further tested this problem - this time with cURL: When a This leads me to the question: Are these three months hard-coded in h2o? How could I work around it? E.g. is it possible to strip the |
One found one more detail. I have captured the fastcgi traffic on the UNIX socket (using socat as described here). When supplying a |
I could identify the Bug! The problem arises, because h2o ignores that the content is dynamic and simply checks the last-modified-time of the PHP file. If the modification time of the file was at least 1 second after the time given by the I guess that this bug is to be found in /lib/handler/file.c (Lines 629-637). |
Found a temporary quick-fix. |
Ah nice find. It looks like simply moving the dynamic handling earlier in the file would result in the behavior you expect:
@kazuho What do you think? Intuitively it sounds like we should always invoke the cgi handler when the content is dynamic? |
This is driving me crazy, but finally I can at least describe the problem:
I have an installation of the CMS TYPO3 running in a FreeBSD jail. Everything seems to be working ok, except that in the backend, a certain URL is returned with a 304 instead of 200. And thus an older version of the content is loaded.
Both Apache (v. 2.4.27 with mod_php) and Nginx (v. 1.12.1 with php-fpm) return the new page with HTTP Status 200. Especially the latter is interesting, as it uses the same php-fpm via UNIX socket as the h2o. I can even stop h2o and start nginx and nginx serves the correct new version. And in the other direction, I can stop nginx, start h2o and get a 304 instead.
Does anyone have an idea, what could possibly be the reason for this difference?
Here are the HTTP headers, when I force-reload the URL from h2o (CTRL + SHIFT + R):
Note, all the cache-related headers indicating that this page should not be cached!
And here h2o upon normal reload (STRG + R) replies with the wrong 304:
Nginx and Apache always reply with a 200, like this:
I tried different browsers (Firefox and Chromium), different caching headers, HTTP/1 and HTTP/2... the result is always the same.
Is this some kind of bug in h2o? Or could a certain parameter or environment variable not be passed to php-fpm in h2o but in Nginx and Apache?
The text was updated successfully, but these errors were encountered: