Forum How do I...?

How do I debug if command is creating cookies before making http request in prince command

I am using prince to convert to pdf for multiple URLs of a site that requires some cookies to load.
After running command, it is generating pdf for the page authentication error page. As URL path is not open for all.
What I am thinking is there must be some issue while setting up cookies, and I can't seem to debug the issue.

I have tried running different versions of Prince but I can't seem to say confidently that cookies are being set up correctly. I have used all documentation of prince but can't find how to proceed further.

I tried using
1. --cookie=cookie_name=cookie_value;
2. --cookie-file=file_path;

File contained below
Set-Cookie: cookie_name=cookie_value; Path=/; Expires=Wed, 09 Apr 2024 12:00:00 GMT; domain=http://localhost:8080/

Note -
When I am accesible those URLs in browser or postman using cookie, they are returning appropriate response of html there.
wangp
You can pass --curl-verbose to see the HTTP requests and responses.

The problem with your --cookie option is that it does not include a domain. Newer versions of curl will not send the cookie in that case. So you want:
--cookie 'cookie_name=cookie_value; domain=localhost'


The problem with the Set-Cookie line in your cookie file is that the value of the 'domain' attribute should be a (sub)domain, not a URL. So you want:
Set-Cookie: cookie_name=cookie_value; Path=/; Expires=Wed, 09 Apr 2024 12:00:00 GMT; domain=localhost
Thanks much!!!!!! This worked for me when I used domain=localhost

@wangp, Can you please give some remark on how you came up with it?
wangp
This is documented because we had noticed the change to curl previously:
https://github.com/curl/curl/issues/6723
https://github.com/curl/curl/pull/7077/files
Thanks!!

Adding https://stackoverflow.com/questions/1612177/are-http-cookies-port-specific

Got to know it today,
There is no way to limit cookies to a single DNS name only [...] likewise, there is no way to limit them to a specific port