Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Latest 7.x release throws this warning:
Adv CSS/JS Agg - Content-Type The wrong Content-Type is being sent by your web server.
The web servers configuration will need to be adjusted. Was looking for
text/javascript, actually got application/javascript. You might need to apply
the drupal core patch located here https://drupal.org/node/1440534.
What is the reasoning behind this? I couldn't find any useful issue nor commit to explain this change. Note that application/javascript
is Nginx default mime type for .js
file extension.
Comment | File | Size | Author |
---|---|---|---|
#10 | advagg-2186069-9-fix-js-type.patch | 1.31 KB | mikeytown2 |
#5 | advagg-2186069-5-fix-php-error.patch | 622 bytes | mikeytown2 |
#4 | advagg-2186069-4-follow-rfc-4329.patch | 6.91 KB | mikeytown2 |
Comments
Comment #1
omega8cc CreditAttribution: omega8cc commentedFix the title.
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commentedThink this is a duplicate #2186989: Advagg uses obsolete Content-Type: text/javascript ; status page reports incorrectly
Fix this at the same time
#1440534: Gzipped javascript sends wrong Content-Type response header on Litespeed webserver
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedCreated a core issue for this #2193333-2: Follow RFC 4329; use application/javascript instead of text/javascript
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedThis patch has been committed.
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedThis has been committed as well
Comment #7
ErikHendrick CreditAttribution: ErikHendrick commentedA) NGINX
B) Applied Patch to /.htaccess but did not work
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commentedI need to add in application/x-javascript to the list of acceptable content types for javascript.
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commentedFollowing patch has been committed
Comment #11
Pinky Brain CreditAttribution: Pinky Brain commentedI don't know if it helps, but the .htaccess file in "../sites/default/files/advagg_js" caused that warning in my installation. To heal it I simply changed line 26 of the .htaccess file from "Header set Content-Type text/javascript" to "Header set Content-Type application/javascript"
Comment #12
mikeytown2 CreditAttribution: mikeytown2 commented@Pinky Brain
Have you ran update.php? did advagg_update_7203 run? That update should have taken care of the htaccess file inside of
sites/default/files/advagg_js
Comment #13
Pinky Brain CreditAttribution: Pinky Brain commentedYes, I ran update.php. But I don't know if advagg_update_7203 ran. All I know is, that I manually changed the htaccess.
But to be fair, my system was contaminated (the SQL-injection thing, I think) and because of this I had some weird problems with advagg (after a while the css files were pointing to wrong domains).