?
avatar ceford
ceford
3 Feb 2020

Steps to reproduce the issue

Create a page with any broken image, css or js link.

Expected result

Page renders as expected. But...

Actual result

If you put the link in the browser url field you well get a standard Joomla Page Not Found page. Joomla has loaded the application stack to return a 404 Not Found page for every such broken link. And the browser has not used them - it only needs the 404 header. It would be faster and less resource demanding to let Apache return the 404 not found header.

System information (as much as possible)

Only relevant for Apache based sites

Additional comments

Add this at line 78 of htaccess.txt:

# and the request is not for an image, css or js file
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.jpeg|\.gif|\.svg)$ [NC]
avatar ceford ceford - open - 3 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Feb 2020
avatar mbabker
mbabker - comment - 3 Feb 2020

This should not be in the htaccess file by default. It is perfectly acceptable to have a PHP application generate these “static” resource types, even if less performant than serving a file; this opinionated of a rule in the default file would effectively make it impossible for extensions to serve responses for these file types if they were configured to be able to do so. You are welcome to customize the file and add any rule you like. Personally, I use rules to not try and boot my PHP applications if the request is for a path that contains these types of resources (so in Joomla that’d be the media and templates directories for starters) instead of not rewriting based on file extension (in one application we have a package that handles automatically generating the different variations (optimized sizes for different frontend slots, watermarked or not, etc.) of an uploaded image if that resource has not already been saved to the filesystem, a web server rule flat out not rewriting for JPG or PNG would keep this package from working at all).

avatar ceford
ceford - comment - 3 Feb 2020

Thanks for the extended comments for why this was not a good idea. I first noticed the problem when the debugger went through umpteen page load cycles. That was because I was using 'onerror' in the img tag to fetch images from the production server if they did not exist on the development server. I think end-users should at least know about the issue.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27790.

avatar ceford
ceford - comment - 7 Feb 2020

I have now read about water-marking, a topic I have never before needed to work with, and realise my suggestion for htaccess was not appropriate as a default. Once again thanks to mbabker for his comments. This issue can be closed (but I don't see a Close button).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27790.

avatar alikon alikon - change - 7 Feb 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-02-07 12:50:13
Closed_By alikon
avatar alikon alikon - close - 7 Feb 2020

Add a Comment

Login with GitHub to post a comment