Force DNS resolving in cURL with the –resolve switch

It’s possible to force DNS resolving in cURL using the –resolve switch. The –resolve switch allows you to tell curl which address to request when it would resolve a given hostname. The format of the argument is domain:port:ip # HTTPS Example curl -I -L https://domain.example.org/ \ –resolve domain.example.org:443:192.168.0.1 # HTTP Example curl -I -L http://domain.example.org/ …


This content originally appeared on Bram.us and was authored by Bramus!

It’s possible to force DNS resolving in cURL using the --resolve switch.

The --resolve switch allows you to tell curl which address to request when it would resolve a given hostname.

The format of the argument is domain:port:ip

# HTTPS Example
curl -I -L https://domain.example.org/ \
  --resolve domain.example.org:443:192.168.0.1

# HTTP Example
curl -I -L http://domain.example.org/ \
  --resolve domain.example.org:80:192.168.0.1

Handy for testing a new server or load balancer you’ve prepared, or when wanting to bypass Cloudflare Proxying without touching Cloudflare’s settings.

~

Did this help you out? Like what you see?
Thank me with a coffee.

I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

☕️ Buy me a Coffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2022-02-10T20:07:34+00:00) Force DNS resolving in cURL with the –resolve switch. Retrieved from https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/

MLA
" » Force DNS resolving in cURL with the –resolve switch." Bramus! | Sciencx - Thursday February 10, 2022, https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/
HARVARD
Bramus! | Sciencx Thursday February 10, 2022 » Force DNS resolving in cURL with the –resolve switch., viewed ,<https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/>
VANCOUVER
Bramus! | Sciencx - » Force DNS resolving in cURL with the –resolve switch. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/
CHICAGO
" » Force DNS resolving in cURL with the –resolve switch." Bramus! | Sciencx - Accessed . https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/
IEEE
" » Force DNS resolving in cURL with the –resolve switch." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/. [Accessed: ]
rf:citation
» Force DNS resolving in cURL with the –resolve switch | Bramus! | Sciencx | https://www.scien.cx/2022/02/10/force-dns-resolving-in-curl-with-the-resolve-switch/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.