Monday, February 4, 2019

Dynamics 365 on-premises / Chrome 72 download issue and work around

Chrome 72 has changed the way it handles the Content-Disposition HTTP response header (and possibly others).  This change has affected how Microsoft Dynamics 365 delivers downloads.

When you download a file from Dynamics, it delivers a file with an HTTP response like so, for a file named "My File.pdf"

HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/octet-stream
Server: Microsoft-IIS/8.5
REQ_ID: a9dabf5d-ee18-40ad-aa76-a5b025d73e24
X-UA-Compatible: IE=8;IE=9;IE=10;IE=11
Content-Disposition: attachment; filename='My%2b%20File.pdf'
ContentLength: 956641
X-AspNet-Version: 4.0.30319
Persistent-Auth: true
X-Powered-By: ASP.NET
Date: Fri, 01 Feb 2019 22:02:33 GMT


Per spec, quoted-strings should be quoted using double quotes.  It looks like the issue is Chrome gravitated more towards spec and decided to stop supporting single quotes in quoted-strings.

Chrome 72 is now treating the single quotes as part of the actual file name.

If you have a comma in your filename, you'll receive an abort: ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION
Chrome thinks the server is trying to deliver multiple files which it doesn't allow in this situation.

Otherwise, Chrome will just save the file with the single quotes.  In this case, the file is perfectly valid and just needs to be renamed, removing the leading and trailing single quotes.  This might prove challenging for users where the operating system will be hiding the file extensions:
That is the safe work-around until Microsoft or Chrome releases a fix.

Reading any further may cause Microsoft to not support your installation.

This work-around is only valid for Dynamics 365 on-premises.  It has been tested with 8.2.2 and 8.2.3.  It has NOT been tested with 9.x.  Online users will have to wait for Microsoft or Chrome to release a patch.

For Microsoft Dynamics 365 on-premises, a work around (to be deployed by a System Administrator) is to modify the CRM website's web.config. WARNING: This is very much unsupported and may cause issues with subsequent upgrades.  It may cause other issues.  This work around has been tested for downloads out of CRM in Chrome 71, Chrome 72, Edge, IE11, and Firefox.

1. Save a backup the web.config
2. Edit the web.config file
3. Browse to XML Path:
  • 8.2.2:  the /configuration/system.webServer/rewrite node
  • 8.2.3:  the /configuration/location/system.webServer/rewrite node

4. AFTER (not in) the ... element paste:

<outboundRules>
  <rule name="Content-Disposition filename" preCondition="IsSingleQuoteFileName">
    <match serverVariable="RESPONSE_Content_Disposition" 
      pattern="(.* filename=)('([^'].+)')(.*)" />
    <action type="Rewrite" value="{R:1}&quot;{R:3}&quot;{R:4}" />
  </rule>
  <preConditions>
    <preCondition name="IsSingleQuoteFileName">
      <add input="{RESPONSE_CONTENT_DISPOSITION}" pattern=".* filename='[^'].+'" />
    </preCondition>
  </preConditions>
</outboundRules>

This uses the IIS Rewrite Module to replace single quotes wrapping a filename, in the HTTP response Content-Disposition header, with double quotes.

5. Save the file. Warning: your Microsoft Dynamics 365 website will recycle.  You should apply this while users are not in the system.

If there were any issues (added , your Dynamics website may fail to load.  Restore to the backed up web.config.



I'm started an issue with the Chromium team here:  https://bugs.chromium.org/p/chromium/issues/detail?id=927913
Update 2/5/2019: Operating per spec; WontFix.

I'll be starting an issue with the Dynamics team on 2/4/2019, when partner support opens.
Update 2/5/2019:  The first line of support has reproduced and escalated.  According to the support analyst, the issue does NOT occur in their online environment.

Update 2/6/2019: 

1. Chrome team monitoring the size of the change's affect.  My case has been merged into this case: https://bugs.chromium.org/p/chromium/issues/detail?id=927366

2. I've been informed by Microsoft that this will be patched for online in "one of the next weekly releases."  Also versions 8.2 and 9.0 on-premises (didn't mention whether that is 8.2.2 or 8.2.3; no timeline yet).

Update 2/19/2019: Microsoft plans to release to on-premises, in 8.2.3.249, on March 12th, 2019.  (I assume also a 9.x version for on-premises but don't have confirmation on that.

8 comments:

Jonathan Larson said...

Thanks for putting this together. Do you have any thoughts about what might be done for a SaaS customer who is experiencing the issue with Chrome 72?

John Hoven said...

Hi Jonathan,

If you can't get your service provider to fix the issue, your only option would be to use another browser (or manually re-name files). Feel free to point your service provider at this information.

Thanks,
John

Mike T said...

Great information. We are having the same issue with users Exporting Excel files from CRM. My workaround was to tell Windows to open xlsx' files with Excel although it does give a warning message when trying to open.

mahesh chemmala said...
This comment has been removed by a blog administrator.
SelvaTuner said...
This comment has been removed by the author.
KK said...

Does update 8.2.4.6 contain the fix ?
I was not able to find exact information in the release notes.

John Hoven said...

@KK,

I just downloaded the 8.2.4.6 update and tested the issue.

I can confirm the issue is resolved. Also, if you've edited the web.config per this blog, it successfully removes those changes.

Mike Ober said...

Thanks for this information. I'm passing it to Ellucian as they have this issue.

Mike.