Blog

Back to blog posts

[Solved] Error – Couldn’t connect to server localhost

Published Feb 12, 2019

Fixing the Issue

localhost is your development machine. If you send a url to a PDF to API2PDF that is localhost, there is nothing API2PDF can do. Localhost is your own machine, and API2PDF lives in the cloud on AWS Lambda, so it has no access to your file. That is why when you send urls to API2PDF, either with the URL to PDF endpoint or the Merge PDFs endpoints, the urls have to be live and accessible on the web at a real url.

This is not an API2PDF specific problem. If you need to run code on your development machine but test against an API or webhook service, you need to provide a mechanism for those services to access your development machine with a valid url.

We recommend looking into either of the following:

Both are free and allow you to establish a secure tunnel to your localhost machine. You will get a legitimate url that you can use to send to services like API2PDF.

Hope that helps.