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).

Files: 

Comments

mikeytown2’s picture

Status: Active » Needs review
FileSize
504 bytes
PASSED: [[SimpleTest]]: [MySQL] 40,711 pass(es). View
mikeytown2’s picture

FileSize
653 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-2193333-2-follow-rfc-4329.patch. Unable to apply patch. See the log in the details link for more information. View
pedrocorse’s picture

hello
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

mikeytown2’s picture

where do you add the line: AddType application/javascript .js ?

Add it at the very bottom of your .htaccess file.

RaulMuroc’s picture

To me this patch doesn't solve anything :S It stills shows the same error in advagg.

Thank you.

mikeytown2’s picture

@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

RaulMuroc’s picture

Status: Needs review » Fixed

@mikeytown2, thank you. Apparently the problem was to have the "AllowOverride None" active. Deleted it and restarted apache and everything works cool.

Thanks.

mikeytown2’s picture

Status: Fixed » Reviewed & tested by the community

This 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.

RaulMuroc’s picture

It appeared back the error suddenly after a cron run.

That's all explanation I have :(

mikeytown2’s picture

@RaulMuroc
Your httpd conf isn't setup ideally. Use include
http://drupal.stackexchange.com/questions/108301/adding-htaccess-within-...

RaulMuroc’s picture

Yes it is, cuz this site is working 5 years without problems.

messiahcide’s picture

How would one fix this error without access to httpd conf, after applying the patch and receiving the same error?

mikeytown2’s picture

@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.

David_Rothstein’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs review
Issue tags: +needs backport to D7

I 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...

RaulMuroc’s picture

Again, the patch doesn't do anything. Today fresh D7 installation with latest version of advagg, patch applied. Nothing, the warning stays.

srobert72’s picture

I 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.

srobert72’s picture

FileSize
19.4 KB

One 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 !!

RaulMuroc’s picture

But then I lose the advantages of using a CDN (specially performance and/or scalability)

srobert72’s picture

@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.

Status: Needs review » Needs work

The last submitted patch, 2: drupal-2193333-2-follow-rfc-4329.patch, failed testing.

mikeytown2’s picture

Status: Needs work » Needs review
FileSize
795 bytes
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 88,018 pass(es). View

Re rolled as .htaccess changed in core recently.

mikeytown2’s picture

#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.

drupalnewie @berfi’s picture

Hi 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

drupalnewie @berfi’s picture

Hi guys!

I solved the problem by change the application/x-javascript to application/javascript in nginx mimetype file.

thanks

mgifford’s picture

re-uploading for bots.

droplet’s picture

We may have to add gzip to both MIME type. It's all common usage.


+++ b/.htaccess
@@ -171,3 +171,6 @@ DirectoryIndex index.php index.html index.htm
+# Follow RFC 4329; use application/javascript for .js files.

this line may not safe to use when the module is missing. let wrap it with IfMoudle..etc

droplet’s picture

droplet’s picture

Strange, d.org taken my old upload ? adding spaces

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

droplet’s picture

Can I sign it off myself? Patch #29 is taken from well-tested HTML5 boilerplate and it almost same as #26. #23 has RTBC.

droplet’s picture

Status: Needs review » Reviewed & tested by the community
mikeytown2’s picture

Also 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

DamienMcKenna’s picture

There 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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 34: drupal-n2193333-34-d8.patch, failed testing.

dinarcon’s picture

Issue tags: +Needs reroll

This needs a reroll after modifications to the .htaccess file from SA-CORE-2016-003 (8.1.7)

costellofax’s picture

I'm working on the reroll as part of #D4DBoston sprint

costellofax’s picture

Status: Needs work » Needs review
FileSize
782 bytes

This is the reroll on 8.1.x

dinarcon’s picture

Thank 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.

Status: Needs review » Needs work

The last submitted patch, 38: follow_rfc_4329_use-2193333-38.patch, failed testing.

dinarcon’s picture

Status: Needs work » Needs review

mmm the tests that are failing do not seem to be related with the changes we are making. Queue for retesting.

dinarcon’s picture

Issue tags: -Needs reroll

Removing the "Needs reroll" tag as this has been address already.

costellofax’s picture

Thanks @dinarcon !!

dinarcon’s picture

Status: Needs review » Reviewed & tested by the community

The tests have passed. Yay! I have already tested this (#39). Marking RTBC. Thanks to everyone who worked on this issue!

The last submitted patch, 34: drupal-n2193333-34-d7.patch, failed testing.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/.htaccess
@@ -187,3 +187,9 @@ AddEncoding gzip svgz
+<IfModule mod_mime.c>
+  # Normalize to standard type.
+  # https://tools.ietf.org/html/rfc4329#section-7.2
+  AddType application/javascript .js
+</IfModule>

I 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.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
934 bytes

How's about something like this?

DamienMcKenna’s picture

Backported to 7.x.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.