grunt-connect-proxy: Unable to download pdf files through the proxy
Hi everyone,
I am unable to download pdf files through the proxy served by an ordinary servlet at /myapp/pdfservlet/ on my tomcat server.
When I try without proxy, pdf files are correctly downloaded.
Here is my proxy configuration:
{
context: '/', // the context of the data service
host: localhost, // wherever the data service is running
port: 8080, // the port that the data service is running on
ws: true, // Proxy websocket
rewrite: { '^/myapp/realtime/fallback': '/myapp/realtime'},
excludedFileTypes: ['pdf', 'jar', 'gz']
}
Here is the request/response given by Chrome:
Remote Address:127.0.0.1:9000 Request URL:http://localhost:9000/myapp/pdfservlet Request Method:GET Status Code:200 OK Request Headers Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip,deflate,sdch Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,de;q=0.2,es;q=0.2 Connection:keep-alive Host:localhost:9000 Referer:http://localhost:9000/myapp/jsp/foo.jsp User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36 Response Headers connection:close content-disposition:filename="foo.pdf" content-language:fr-FR content-type:application/pdf;charset=UTF-8 date:Wed, 10 Sep 2014 17:36:13 GMT server:Apache-Coyote/1.1 transfer-encoding:chunked
It also happens on .gz files.
It seems that the connection is closed before the end of the file because the pdf is just blank.
Am I missing something?
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 20
Commits related to this issue
- Downgrades grunt-contrib-connect to 0.5.0 see https://github.com/drewzboto/grunt-connect-proxy/issues/73 — committed to tenor-conference/tenor-website by deleted user 9 years ago
- Use an earlier version of grunt-contrib-connect to allow PDFs to render correctly via the grunt server Solution from: https://github.com/drewzboto/grunt-connect-proxy/issues/73#issuecomment-100352502 — committed to sardjv/www.sardjv.co.uk by alexrudall 7 years ago
I just found the solution for my case! For the record, I was using
grunt-connect-proxy#0.1.11. My project was generated by Yeoman. Yeoman generated automatically apackage.jsoncontaining:In
package.json, I changed thegrunt-contrib-connectversion to0.5.0which is the one pulled bygrunt-connect-proxy#0.1.11.That solved
pdfandgzcorruption ! Don’t forget to disable your browser cache for your pdf fetch tests.I’ve got the same problem…
this works…
this does not…