wkhtmltopdf error network status code 4 and http status code 0

Published on Author JFLeave a comment

You might get the following error/s with wkhtmltopdf :

Error: Failed to load https://www.yoursite.com/some-pdf-gen-url/, with network status code 4 and http status code 0 – Socket operation timed out
Warning: Failed loading page


exit with code 1 due to network error: timeouterror

First, try cURLing your site:

curl https://www.mysite.com

If that fails, it is because DNS is pointing to the public IP and the network has not been configured to allowing pinning external IP Addresses.

The easiest solution is add    www.yoursite.com 

to /etc/hosts

Then try cURL again to test. If cURL works, try to generate your PDF.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.