Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

marcw's avatar
Level 2

curl request on localhost

I want to make a api request to a site deployed by forge (on hetzner cloud).

The bash curl command I was trying is as follows:

curl -X POST -H "Content-Type: application/json" -F fullpath=foo -F name=foo  https://127.0.0.1/add

Obviously this cannot work as the site isn't specified. It probably tries to open the default site.

Therefore I get an error message.

curl: (35) error:0A000458:SSL routines::tlsv1 unrecognized name

How can I specify the site in the URL?

0 likes
5 replies
marcw's avatar
Level 2

I assumed using the domain itself would try to open it over WAN. Does a site regularly installed with forge resolve the domain locally?

marcw's avatar
Level 2

I tried cURL's --resolve option and it actually works.

curl -X POST -F formfield1=foo -F formfield2=foo --resolve example-domain.com:443:127.0.0.1 https://example-domain.com

Thanks @gych

1 like
gych's avatar

@marcw No problem I'm glad you got it working now :) Please don't forget to mark your thread as solved.

Please or to participate in this conversation.