xref: /curl/docs/cmdline-opts/resolve.md (revision 1f1975b8)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: resolve
5Arg: <[+]host:port:addr[,addr]...>
6Help: Resolve host+port to address
7Added: 7.21.3
8Category: connection dns
9Multi: append
10See-also:
11  - connect-to
12  - alt-svc
13Example:
14  - --resolve example.com:443:127.0.0.1 $URL
15---
16
17# `--resolve`
18
19Provide a custom address for a specific host and port pair. Using this, you
20can make the curl requests(s) use a specified address and prevent the
21otherwise normally resolved address to be used. Consider it a sort of
22/etc/hosts alternative provided on the command line. The port number should be
23the number used for the specific protocol the host is used for. It means
24you need several entries if you want to provide address for the same host but
25different ports.
26
27By specifying `*` as host you can tell curl to resolve any host and specific
28port pair to the specified address. Wildcard is resolved last so any --resolve
29with a specific host and port is used first.
30
31The provided address set by this option is used even if --ipv4 or --ipv6 is
32set to make curl use another IP version.
33
34By prefixing the host with a '+' you can make the entry time out after curl's
35default timeout (1 minute). Note that this only makes sense for long running
36parallel transfers with a lot of files. In such cases, if this option is used
37curl tries to resolve the host as it normally would once the timeout has
38expired.
39
40To redirect connects from a specific hostname or any hostname, independently
41of port number, consider the --connect-to option.
42
43Support for resolving with wildcard was added in 7.64.0.
44
45Support for the '+' prefix was added in 7.75.0.
46