blank/white page error in react js app ( stopped working in chrome and edge all of a sudden)

876 Views Asked by At

I have a react app which is in production for few years now, everything was working just fine but all of a sudden a it has stopped working (only a particular function of the app) as mentioned below -

There's a table on the UI which contain a list of attachments/documents and a anchor tag as a link to the attachment, on click of a link it calls a spring boot API which return byte stream with headers as below -

return ResponseEntity.ok()
            .header(HttpHeaders.CONTENT_DISPOSITION,
                    "attachment; filename=\"" + document.getName() + "\"")
            .header(HttpHeaders.CONTENT_TYPE, "application/octet-stream")
            .body(documentData.getData());

This was all working so far in all browsers including IE, chrome and edge and it is still working in IE browser but has stopped working in chrome and edge browsers. When I click on the attachment link in chrome and edge it just shows a blank/white page and the document doesn't download.

When I check in the developer console, it shows that API has worked just fine with 200 as status and in response it shows some html code which refers to few assets (css and js files), content type shows as text/html though api returns application/octet-stream.

Now this all still works in IE but has stopped working in chrome and edge browsers, if I launch the app in local dev server running on localhost 3002 then the download works in chrome and edge as well.

Please can someone advise what could be the issue and what can be done to get this working.

This is my project structure - project structure

Response headers returned by download api call are -

Accept-Ranges: bytes

Cache-Control: no-cache, no-store, max-age=0, must-revalidate Content-Length: 1005 Content-Type: text/html Date: Thu, 28 Apr 2022 15:16:18 GMT Dws-Correlation-Id: 5d39b7aa0d734cf48090ce584d9d05be Expires: 0 Last-Modified: Thu, 28 Apr 2022 16:07:58 GMT Pragma: no-cache Strict-Transport-Security: max-age=31536000 ; includeSubDomains Vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Vcap-Request-Id: fc375cb0-25cd-498d-7620-381e873164e3 X-Xss-Protection: 1; mode=block

thanks in advance

0

There are 0 best solutions below