-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Duplicate cookies when printing Header/Footer #1870
Comments
Can you post the exact command line used? |
What happens, if you put the parameter |
It's working. Footers print correctly, now i have first page wihthout content but with footer, webpage content rendered from second page ant it's correct. My command line is
|
If it's working now it can be closed. |
No, it's not working. It's a workaround that generates another issue: #1903 |
I got the same issue adding [page] before --cookie helped, but I would consider this as workaround, please reopen and further investigate. |
What happens if you use
i.e. put the |
If you put cookies after target URL authentication will not work. This is my solution: |
adding --load-error-handling abort has no improvement my sample command line arguments: |
I have confirmed that the solution mentioned by @serovpetr works, even without fiddling with header propagation. Just relace |
@TripleEmcoder's solution does not solve the problem because the custom header is not used in HTTP requests for content embedded within the page. E.g. if the HTML page has an image that also requires authentication, the request will not have the Cookie header (wkhtmltopdf 0.12.1 (with patched qt)) |
You can use |
When will this fix / release 0.12.3 be available? |
@mrbokx: as I can work on this project in my spare time (which has been non-existent lately due to a family emergency), there is no ETA for this fix and the |
Is the issue resolved in the latest wkhtmltopdf release? We are having same issue with the cookies that are duplicating with the subsequent requests. It works fine with lesser number of urls. Also the suggested --custom-header (with/without --custom-header-propagation) solution is not working for us. |
Any of the workaround works for us. |
@pdas77 Why not?
For example; a solution for ASP.NET C# with Rotativa plugin
works for us |
Thanks @mrbokx for the suggestion. I already tried using Cookie in custom-header option, I get AuthenticationRequiredError. Successful Conversion Command: using --cookie option Failed Conversion Command: using Cookie in --custom-header option *_Error: Am I doing it correctly? What I have got feedback that when we use Cookie in --custom-header option, the entire cookie value does not got if it is large. is that true? In our case, very large cookies required to download the page. |
Looks like #3257 should fix this error. |
using --custom-header worked for me as long as the page being printed doesn't make subsequent ajax calls. Unfortunately, if the page does make subsequent ajax calls, the cookie isn't being sent with that call. I am specifying --custom-header-propagation as well. |
I see this issue is resolved in 0.12.5 (#3257). Will you release binaries for version 0.12.5? On https://wkhtmltopdf.org/downloads.html the latest version is 0.12.4... |
Adding Cookie in custom header like "--custom-header Cookie" worked for me. This is my sample command : wkhtmltopdf --header-html http://localhost:52127/ProposalDocument/_Header --footer-html http://localhost:52127/ProposalDocument/_Footer --custom-header Cookie ".AspNetCore.Antiforgery.5uYu5VgZzcE=abc123;JWTToken=xyz123;.AspNetCore.Cookies=xyzabc123" --no-custom-header-propagation http://localhost:52127/ProposalDocument/ProposalDocument D:\htmltopdfTest\test.pdf |
A release candidate is available which includes the fixes made for this issue -- please test and report your findings before the final release. |
wkhtmltopdf Version : 0.12.1.0
Operating System and Version: Windows 7 Enterprise x64 Service Pack 1
Application based on ASP.Net
Description:
I'm trying to generate PDF with footers or headers. The source page, requires form authentication, so I pass cookies to converter using --cookie argument.
Main html converts correctly, but when converter send requests to footer html page, in debugger I see cookies duplicate in request. The result is that by URL number 6 (for examle) there are then 6 times the number of cookies, because of one of cookies is an auth cookie, request quickly becomes too big and IIS blocks it.
Result:
So if Geneated pdf contanins more then 6 ~ 7 pages, converter exits with error code =1, but I can open Result Pdf. After 7 page, instead of of footer i see Label: "Http error 400 Bad Request. Request header too Large "
When i use cookie-jar argument, with username and password, everything works correctly, but I can't use this way because of security context.
The text was updated successfully, but these errors were encountered: