-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Still empty content-encoding when it is not set #130
Comments
I can confirm this. Using:
Thanks @Maxim-Filimonov for suggesting a (temporary) fix to this problem. Really has giving me headaches with users complaining about botched CSS and JS. |
@fcheung I know you have looked at this previously, any ideas where we might be going off the rails still? Thanks! |
Not really. I had a look at boto and it seems to implement as we did, and the aws ruby sdk doesn't implement the streaming upload stuff at all (it looks like it would read the entire file into memory in order to compute its sha). I opened a support ticket with AWS about it but haven't heard back yet.
|
AWS have confirmed to me that they can reproduce this, ie it isn't an issue with the fog implementation of this. No workarounds for now other than avoid this code path (ie use signature v2, or don't use the stream upload feature (in fog this is triggered if the body responds to :read)). They have asked me for more details of issues caused by the blank header - can someone chime in with that (exact symptoms, browsers affected etc) |
@fcheung got it, thanks again for digging in on this. |
@rhomeister @Maxim-Filimonov if you have details on what symptoms end users are seeing that would be helpful to AWS. In the mean time passing |
@fcheung It affects CDN we use - Cloudflare as it cannot determine encoding when content-encoding is set to empty string. I heard about other CDN's but I don't remember exact names |
I'm also using Cloudflare with S3, but I'm not sure if Cloudflare is the cause of this problem. The symptoms are that the gzipped version gets served as the plain one, resulting in garbled CSS or JS. This happens in certain browsers, among which IE.
|
Thanks for the info - I have passed it on |
I can also confirm this. Is there any way to force aws_signature_version to 2 when using asset sync? Gems:
I am syncing assets with Gzip compression disabled. After doing this, the AWS console S3 page shows Content-Encoding with a blank value: Interestingly, I can't save things on the AWS console with a blank value. After clicking save: The URLS are then served with a blank content-encoding string: $ curl -v 'https://s3-eu-west-1.amazonaws.com/whatever.css'
< HTTP/1.1 200 OK
...
< Content-Encoding:
< Last-Modified: Thu, 18 Jun 2015 17:16:10 GMT |
I had a quick look through the asset sync source and it didn't look like there was a way to change how the fog::storage instance is created, beyond the settings asset sync has provided. What effect is the blank content encoding having on the served assets? |
The asset_sync gem uses fog-aws to upload assets to S3. However fog-aws > 0.1.2 sets the Content-Encoding to null value. This gem can be removed once fog/fog-aws#130 is correctly resolved
The asset_sync gem uses fog-aws to upload assets to S3. However fog-aws > 0.1.2 sets the Content-Encoding to null value. This gem can be removed once fog/fog-aws#130 is correctly resolved
The main problem occurs when combined with something proxying the assets (specifically nginx). (We store all assets in S3, but run our own proxy to respond with the assets from s3, rather than cloudfront or similar.) As you can see from http://forum.nginx.org/read.php?2,257672,257672#msg-257672 nginx doesn't handle cases where the Content-Encoding is supplied but is blank. When nginx does dynamic compression of the asset when serving it, the resulting headers then look like this:
This duplication breaks Safari terribly, since the content-encoding is now gzipped, and Safari uses the first header, and believes the original content to not be gzipped. Most other browsers appear to do the right thing. It's possible to strip out the offending blank headers with nginx, as per followups to that thread. However, I don't think that returning a blank header is the right thing to do in the first place :) |
The asset_sync gem uses fog-aws to upload assets to S3. However fog-aws > 0.1.2 sets the Content-Encoding to null value. This gem can be removed once fog/fog-aws#130 is correctly resolved
Thanks for the extra info!
|
This fix should be in 0.7.1 and above if you want to give that version a whirl. |
This issue has been marked inactive and will be closed if no further activity occurs. |
Closing as it sounds like it was fixed some time ago. |
We are experiencing empty content-type with v0.4.0 when using with middleman-s3_sync needed to downgrade all the way to 0.1.2 to fix it.
The text was updated successfully, but these errors were encountered: