All- We've been doing some heavy testing on 4.6 and found a piece that is good (I think) for all Drupal versions. In .htaccess, Drupal's index.php file is defined as the default 404 handler. This can cause real problems when an image or other file is missing, A little research by our tech guys gives us this: # This overrides the Drupal 404 handler for files that should never be handled by Drupal <FilesMatch "\.(gif|jpe?g|png|html|css|js)$"> ErrorDocument 404 default </FilesMatch> This makes Apache handle 404 errors for typical html and image files. Should this be submitted officially? - Ken Rickard agentrickard
handled by Drupal <FilesMatch "\.(gif|jpe?g|png|html|css|js)$"> ErrorDocument 404 default </FilesMatch>
This makes Apache handle 404 errors for typical html and image files.
Should this be submitted officially?
I will agree that this is useful, with the suggestion that "html" becomes "s?html?", for those using .shtml or .htm files. -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779 icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
I've been working a combo module/theme that serves dynamic CSS (ie. http://www.example.com/my/menu/path/dynamic.css). I might prefer to have errors show up in the Drupal logs. But this is not a hard requirement for me. -Mark
From: Morbus Iff <morbus@disobey.com> Reply-To: <development@drupal.org> Date: Thu, 30 Mar 2006 16:15:15 -0500 To: <development@drupal.org> Subject: [bayes][heur][bcc][faked-from] Re: [development] 404 handling
handled by Drupal <FilesMatch "\.(gif|jpe?g|png|html|css|js)$"> ErrorDocument 404 default </FilesMatch>
This makes Apache handle 404 errors for typical html and image files.
Should this be submitted officially?
I will agree that this is useful, with the suggestion that "html" becomes "s?html?", for those using .shtml or .htm files.
-- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779 icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
I've been working a combo module/theme that serves dynamic CSS (ie. http://www.example.com/my/menu/path/dynamic.css). I might prefer to have errors show up in the Drupal logs.
This will not be affected. FilesMatch works on *files* - something that literally exists on the hard drive. Your dynamically generated CSS is a URL only, and thus, won't fall under a Files restriction. -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779 icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
On 3/30/06, Morbus Iff <morbus@disobey.com> wrote:
I've been working a combo module/theme that serves dynamic CSS (ie. http://www.example.com/my/menu/path/dynamic.css). I might prefer to have errors show up in the Drupal logs.
This will not be affected. FilesMatch works on *files* - something that literally exists on the hard drive. Your dynamically generated CSS is a URL only, and thus, won't fall under a Files restriction.
First I like the idea that we can exclude certain files from being handled by drupal. A few broken links to images can cause some load and clutter the logs. However, as some said, it would be an advantage if this is handled via PHP inside Drupal, and therefore can be more usable via an nice interface, and can be as simple or as complex as someone wants it to be. Morbus: Re: FilesMatch, does this mean that if I use path/pathauto, and make pages [blah]/[blah].html, this would not apply to them, since they are not files?
On 3/30/06, Khalid B <kb@2bits.com> wrote:
Morbus:
Re: FilesMatch, does this mean that if I use path/pathauto, and make pages [blah]/[blah].html, this would not apply to them, since they are not files?
Correct. Remember, what Apache actually "sees" being called is index.php?q=/pages/blah.html. Hence, not a file. -- Boris Mann Vancouver 778-896-2747 San Francisco 415-367-3595 Skype borismann http://www.bryght.com
"Mark Fredrickson" wrote:
I've been working a combo module/theme that serves dynamic CSS (ie. http://www.example.com/my/menu/path/dynamic.css). I might prefer to have errors show up in the Drupal logs.
But this is not a hard requirement for me.
What's wrong with just using some PHP (a snippet, I think Drupal folks call it) to create your dynamic stylesheet? There are two methods to do this, for any PHP-driven site/page. Pass PHP variable values to: a. an in-page (<style...></style>) declaration. b. an external PHP file that you read as a CSS mime type. I use both methods, and have a "color style changer" that can demonstrate either method. Let me know and I'll post it somewhere or I'll send off list. I prefer the in-page method for page- or directory-specific styles, because local page styles always override imported or linked CSS styles, in the cascade, that is. I also may have mis-understood what it is you're doing! :) -- Gary
handled by Drupal <FilesMatch "\.(gif|jpe?g|png|html|css|js)$"> ErrorDocument 404 default </FilesMatch>
This makes Apache handle 404 errors for typical html and image files.
Should this be submitted officially?
I will agree that this is useful, with the suggestion that "html" becomes "s?html?", for those using .shtml or .htm files.
In talking this over with [Zen|\|gatsby\|], I no longer think that .html, of any extension, should be included in this list. Drupal shouldn't give or generate 404s for broken *embedded* files that it ships with, like gif, jpegs, css, js, etc. just like you have. Good. HTML files, however, are never embedded (I'll ignore, for the sake of sanity, crap like IFRAMES), and should receive the same 404 treatment as other "major" content, like those generated by a Drupal node. -- Morbus Iff ( you are nothing without your robot car, NOTHING! ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779 icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
Drupals 404 handler could be modified to return files of an appropriate mime type... defaul missing images etc...Its something I was thinking of implement in some file work I'm doing. On Thu, 2006-03-30 at 16:41 -0500, Morbus Iff wrote:
handled by Drupal <FilesMatch "\.(gif|jpe?g|png|html|css|js)$"> ErrorDocument 404 default </FilesMatch>
This makes Apache handle 404 errors for typical html and image files.
Should this be submitted officially?
I will agree that this is useful, with the suggestion that "html" becomes "s?html?", for those using .shtml or .htm files.
In talking this over with [Zen|\|gatsby\|], I no longer think that .html, of any extension, should be included in this list. Drupal shouldn't give or generate 404s for broken *embedded* files that it ships with, like gif, jpegs, css, js, etc. just like you have. Good.
HTML files, however, are never embedded (I'll ignore, for the sake of sanity, crap like IFRAMES), and should receive the same 404 treatment as other "major" content, like those generated by a Drupal node.
On 30-Mar-06, at 1:08 PM, Ken Rickard wrote:
We've been doing some heavy testing on 4.6 and found a piece that is good (I think) for all Drupal versions.
In .htaccess, Drupal's index.php file is defined as the default 404 handler.
This can cause real problems when an image or other file is missing, A little research by our tech guys gives us this:
# This overrides the Drupal 404 handler for files that should never be handled by Drupal <FilesMatch "\.(gif|jpe?g|png|html|css|js)$"> ErrorDocument 404 default </FilesMatch>
This makes Apache handle 404 errors for typical html and image files.
Should this be submitted officially?
Yes....*any* idea should get "officially" submitted as an issue...whether or not it gets applied is a separate issue (i.e. this won't be applied in 4.6, will highly unlikely make it into 4.7). Standard procedure would be to submit an issue, then email the dev list with a pointer for further comment if it is of wider interest/ needs discussion. Ken -- thanks for bring this up. -- Boris Mann Vancouver 778-896-2747 San Francisco 415-367-3595 SKYPE borismann http://www.bryght.com
Ken Rickard wrote:
This can cause real problems when an image or other file is missing, A little research by our tech guys gives us this:
What sort of real problems? I tried adding this right after the original ErrorDocument statement and saw no change. http://localhost/drupal/yarr.png was still served up with a 404 from Drupal. And I think this is how it should be. All 404s are logged by Drupal, which is a good thing. And all the 404 pages look the same, also a good thing. What am I missing? -- Neil Drumm http://delocalizedham.com/
On 30-Mar-06, at 9:03 PM, Neil Drumm wrote:
Ken Rickard wrote:
This can cause real problems when an image or other file is missing, A little research by our tech guys gives us this:
What sort of real problems?
And I think this is how it should be. All 404s are logged by Drupal, which is a good thing. And all the 404 pages look the same, also a good thing.
What am I missing?
That 404s cause a full Drupal bootstrap, which can cause extra load in really heavy environments. Handling it at the Apache layer, as is being proposed, means it doesn't hit Drupal at all. It's probably, at least, a useful tip/snippet to be included somewhere. -- Boris Mann Vancouver 778-896-2747 San Francisco 415-367-3595 SKYPE borismann http://www.bryght.com
Boris Mann wrote:
On 30-Mar-06, at 9:03 PM, Neil Drumm wrote:
Ken Rickard wrote:
This can cause real problems when an image or other file is missing, A little research by our tech guys gives us this:
What sort of real problems?
And I think this is how it should be. All 404s are logged by Drupal, which is a good thing. And all the 404 pages look the same, also a good thing.
What am I missing?
That 404s cause a full Drupal bootstrap, which can cause extra load in really heavy environments. Handling it at the Apache layer, as is being proposed, means it doesn't hit Drupal at all.
That 404s cause a full Drupal bootstrap, which can cause extra load in really heavy environments. Handling it at the Apache layer, as is being proposed, means it doesn't hit Drupal at all.
It's probably, at least, a useful tip/snippet to be included somewhere.
oops ... yeah, documentation is probably all thats needed here.
Moshe Weitzman wrote:
That 404s cause a full Drupal bootstrap, which can cause extra load in really heavy environments. Handling it at the Apache layer, as is being proposed, means it doesn't hit Drupal at all.
It's probably, at least, a useful tip/snippet to be included somewhere.
oops ... yeah, documentation is probably all thats needed here.
Since it's just one line, how about documenting by including it in the .htaccess file, commented out and preceded by a line documenting it?
participants (10)
-
Boris Mann -
Chris Johnson -
Darrel O'Pry -
Ken Rickard -
Khalid B -
Lists -
Mark Fredrickson -
Morbus Iff -
Moshe Weitzman -
Neil Drumm