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.
http://tools.ietf.org/html/rfc4329#section-7
We should only change this in the .htaccess file and not in the script tags as explained here: http://stackoverflow.com/questions/9664282/difference-between-applicatio...
Note that using application/javascript in the type attribute of a script element will cause the script to be ignored (as being in an unknown language) in some older browsers. Either continue to use text/javascript there or omit the attribute entirely (which is permitted in HTML 5).
Comment | File | Size | Author |
---|---|---|---|
#62 | drupal-2193333-62-rfc4329.patch | 523 bytes | jacob.embree |
#53 | 2193333-53.patch | 480 bytes | ZeiP |
#48 | drupal-n2193333-48.patch | 1009 bytes | DamienMcKenna |
#34 | drupal-n2193333-34-d7.patch | 857 bytes | DamienMcKenna |
#2 | drupal-2193333-2-follow-rfc-4329.patch | 653 bytes | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedComment #2
mikeytown2 CreditAttribution: mikeytown2 commentedComment #3
pedrocorse CreditAttribution: pedrocorse commentedhello
where do you add the line:
AddType application/javascript .js
?because I always message: "The web servers configuration will need to be adjusted. Was looking for application/javascript, actually got text/javascript. You might need to apply the drupal core patch located here https://drupal.org/node/2193333#comment-8469991."
I add the line after and replace the line "
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
" by "RewriteRule \.js\.gz$ - [T=application/javascript,E=no-gzip:1]
"I do not understand why I always error
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedAdd it at the very bottom of your .htaccess file.
Comment #5
RaulMuroc CreditAttribution: RaulMuroc commentedTo me this patch doesn't solve anything :S It stills shows the same error in advagg.
Thank you.
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commented@RaulMuroc
Have you ran update.php and completed the AdvAgg updates? Have you restarted apache (shouldn't have to do but never know)? If yes, open an issue in the AdvAgg issue queue and I'll do my best to figure out the issue :)
Also noted is have you set AllowOverride None in your httpd.conf file? If so changing the .htaccess file might not fix this as apache may no longer be reading info from drupal's core .htaccess file depending on how you have it setup.
More info: https://groups.drupal.org/node/22864
Comment #7
RaulMuroc CreditAttribution: RaulMuroc commented@mikeytown2, thank you. Apparently the problem was to have the "AllowOverride None" active. Deleted it and restarted apache and everything works cool.
Thanks.
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commentedThis patch has not been committed to core yet, thus it has not been fixed. Marking this as RTBC since you have confirmed that this patch does fix this issue.
Comment #9
RaulMuroc CreditAttribution: RaulMuroc commentedIt appeared back the error suddenly after a cron run.
That's all explanation I have :(
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commented@RaulMuroc
Your httpd conf isn't setup ideally. Use include
http://drupal.stackexchange.com/questions/108301/adding-htaccess-within-...
Comment #11
RaulMuroc CreditAttribution: RaulMuroc commentedYes it is, cuz this site is working 5 years without problems.
Comment #12
messiahcide CreditAttribution: messiahcide commentedHow would one fix this error without access to httpd conf, after applying the patch and receiving the same error?
Comment #13
mikeytown2 CreditAttribution: mikeytown2 commented@messiahcide
I think you're out of luck if that is the case. If access to httpd conf is not granted and changes to .htaccess don't do anything, then I'm afraid there is nothing that can you can directly do. Asking your hosting provider for help as to why .htaccess changes are not happening would be the next step to take.
Comment #14
David_Rothstein CreditAttribution: David_Rothstein commentedI think a change like this needs some more reviews and testing across browsers/servers to make sure it's OK.
The patch also applies to Drupal 8, so I assume the same issue exists there...
Comment #15
RaulMuroc CreditAttribution: RaulMuroc commentedAgain, the patch doesn't do anything. Today fresh D7 installation with latest version of advagg, patch applied. Nothing, the warning stays.
Comment #16
srobert72 CreditAttribution: srobert72 commentedI have the same problem, the warnings never disappear no matter what I do. But I think I found the reason.
I use CDN module, so CSS&JS are delivered to browser by a CDN server and not my Drupal server.
In the warning report "Adv CSS/JS Agg - gzip" I see an URL to the CDN server and not my Drupal server.
So I think the test reports errors about the CDN server and not my Drupal server.
I can change all I want on my server the result will never change.
So I think the test should only be done on the Drupal server, bypassing the rewrites of CDN module.
To be undoubted I desactivate CDN module... and warnings all disappear.
Comment #17
srobert72 CreditAttribution: srobert72 commentedOne workaround is to disable CDN for CSS&JS files.
Go to admin/config/development/cdn/details in CDN mapping
Remove *.js and *.css pattern
Clear All Cache and go back to admin/reports : All is perfect !!
Comment #18
RaulMuroc CreditAttribution: RaulMuroc commentedBut then I lose the advantages of using a CDN (specially performance and/or scalability)
Comment #19
srobert72 CreditAttribution: srobert72 commented@RaulMuroc
Yes but only for CSS & JS files and you can continue to use CDN for images and all others files.
CSS&JS are a little volume compare to others files.
Comment #22
mikeytown2 CreditAttribution: mikeytown2 commentedRe rolled as .htaccess changed in core recently.
Comment #23
mikeytown2 CreditAttribution: mikeytown2 commented#22 passed; I would like to RTBC this.
For people wondering why this isn't working with the patch applied if you've imported all the drupal .htaccess rules into httpd.conf; then you'll need to import these changes as well. If you're using include inside httpd.conf like this: http://drupal.stackexchange.com/questions/108301/adding-htaccess-within-... then you'll need to restart apache. If this is coming from a CDN and you have zero control over the headers then simply ignore this warning coming from AdvAgg. Means the CDN is not following the current RFC for .js file but all browsers still work so you can ignore the warning.
Comment #24
drupalnewie @berfi CreditAttribution: drupalnewie @berfi commentedHi guys! i receive an error in my drupal 7 status page which looks like the problem in this scope:
"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 application/javascript, actually got application/x-javascript. You might need to apply the drupal core patch located here https://drupal.org/node/2193333#comment-8469991."
My webserver is nginx, and i added to the configuration to support application/javascript but, it has not solved my problem.
Will these solution helps drupal 7.34?
Br
Comment #25
drupalnewie @berfi CreditAttribution: drupalnewie @berfi commentedHi guys!
I solved the problem by change the application/x-javascript to application/javascript in nginx mimetype file.
thanks
Comment #26
mgiffordre-uploading for bots.
Comment #27
droplet CreditAttribution: droplet commentedWe may have to add gzip to both MIME type. It's all common usage.
this line may not safe to use when the module is missing. let wrap it with IfMoudle..etc
Comment #28
droplet CreditAttribution: droplet commentedI cloned it from https://github.com/h5bp/html5-boilerplate/blob/master/dist/.htaccess#L178, they're well-tested.
Comment #29
droplet CreditAttribution: droplet commentedStrange, d.org taken my old upload ? adding spaces
Comment #31
droplet CreditAttribution: droplet commentedCan I sign it off myself? Patch #29 is taken from well-tested HTML5 boilerplate and it almost same as #26. #23 has RTBC.
Comment #32
droplet CreditAttribution: droplet commentedComment #33
mikeytown2 CreditAttribution: mikeytown2 commentedAlso agree that #29 is RTBC. Wrapping #22 in IfModule check makes total sense - https://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype
Comment #34
DamienMcKennaThere was an errant space at the end of the file, this removes it. The patch also (mostly) cleanly applied to D7 and 8.2.x
Does this still fit in the realm of a change for 8.1.x? The patch applies to both 8.1.x and 8.2.x.
Comment #36
dinarcon CreditAttribution: dinarcon at Agaric commentedThis needs a reroll after modifications to the .htaccess file from SA-CORE-2016-003 (8.1.7)
Comment #37
costellofax CreditAttribution: costellofax as a volunteer commentedI'm working on the reroll as part of #D4DBoston sprint
Comment #38
costellofax CreditAttribution: costellofax as a volunteer commentedThis is the reroll on 8.1.x
Comment #39
dinarcon CreditAttribution: dinarcon at Agaric commentedThank you @costellofax for your work on this issue! I have tested the patch in #38 and it applies cleanly for 8.1.x and 8.2.x. Let's see what the test bot says. @DamienMcKenna's patch from #34 applies cleanly for 7.x.
Comment #41
dinarcon CreditAttribution: dinarcon at Agaric commentedmmm the tests that are failing do not seem to be related with the changes we are making. Queue for retesting.
Comment #42
dinarcon CreditAttribution: dinarcon at Agaric commentedRemoving the "Needs reroll" tag as this has been address already.
Comment #43
costellofax CreditAttribution: costellofax as a volunteer commentedThanks @dinarcon !!
Comment #44
dinarcon CreditAttribution: dinarcon at Agaric commentedThe tests have passed. Yay! I have already tested this (#39). Marking RTBC. Thanks to everyone who worked on this issue!
Comment #46
alexpottI don't think we should be doing this. Or we could have it commented out. I think most Apache servers are configured correctly so this is just busy work. Even the Apache that comes installed on every Mac is configured correctly. And if we're going to do this one - why stop here - sets a weird precedent.
The other change looks fine.
Comment #47
DamienMcKennaHow's about something like this?
Comment #48
DamienMcKennaBackported to 7.x.
Comment #51
ZeiP CreditAttribution: ZeiP at Citrus Solutions Oy commentedTo me the change looks OK & works properly for 8.3.x as well with the patch in #47. However, I think the comment in #46 still applies: There's little point in adding the MIME type declaration commented-out – if we want to add it, then why not add it effectively? I do agree with @alexpott that declaring only the Javascript MIME type separately in .htaccess seems a bit weird, and if there aren't many proven cases in which the proper MIME type is missing from server configuration, it's busy work and shouldn't be done.
So IMO the patch should only change the RewriteRule.
Comment #53
ZeiP CreditAttribution: ZeiP at Citrus Solutions Oy commentedThe issue's been stale for a few months, so here's the patch containing only the RewriteRule per my/alexpott's suggestion, please review.
Comment #54
mikeytown2 CreditAttribution: mikeytown2 commentedAnd we're back to my patch from #1
Comment #55
droplet CreditAttribution: droplet commented@mikeytown2, Are you sure you can RTBC your own patch then? 😆🤣😜
Comment #56
xjmHm this is a small thing that could have significant implications. I'd like to have the JS subsystem maintainers sign off on this one, and the framework managers. I pinged @drpal for a look and I see @droplet is following as well. Thanks!
Comment #57
dawehnerJust out of couristy I was trying to figure out whether IIS has support for a similar configuration and they do: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/stat...
Their default behaviour is unknown though ...
What do other systems do?
Comment #58
droplet CreditAttribution: droplet commented@dawehner,
IIS has no ZIP redirection in CORE and WP has no rewrite URL for ZIP things also. So they're both following the server configs. (ON-FLY-ZIPPING)
and I think NodeJS (and nginx) just replace the resource in the middleware. They won't change request/response Content-Type. [I can be wrong :)]
Not sure if it explains
Comment #59
droplet CreditAttribution: droplet commentedand you should pass accept gzip to CURL:
Comment #62
jacob.embree CreditAttribution: jacob.embree at 3Sages commentedHere is yet another reroll of #2 and #53.
Comment #63
xjmI think there's some risk of disruption here, so it would probably be a minor-only change. Since 8.9.x and 9.0.x are now in beta, I'm moving this to 9.1.x. Thanks!
Comment #64
nod_Like alexpott said in #46 is this even still an issue? not touching anything the mime type is correct on my end, without this patch. Can we have a exemple of a setup where this problem happens before looking at the patch?
Comment #65
droplet CreditAttribution: droplet commentedThe patch is outdated BTW. After 3 years, it should be
text/javascript
again. LOL.History Is Written by the Victors. 🤐🤐🤐
Comment #66
nod_haha, that's a good one. Got a reference about this? wasn't aware we should be back on text/javascript :p
Comment #69
pameeela CreditAttribution: pameeela commentedhttps://datatracker.ietf.org/doc/html/draft-ietf-dispatch-javascript-mjs...