Reproducing CURL with curl -- resolve: browser?

Abstract: Resolve how to map a hostname to a specific IP in a browser using the hosts file or local proxies to replicate curl --resolve behavior.

Created: 2026-10-02 by
The curl --resolve flag allows you to map a specific hostname to an IP address for a single request, bypassing standard DNS resolution. While browsers do not expose a direct command-line equivalent for ad-hoc testing, you can replicate this behavior by modifying your system's hosts file or configuring browser-specific proxy settings. This approach ensures that the browser resolves the domain to the target IP without altering global network configurations or requiring complex developer tools setups.

Understanding the curl --resolve Flag

The curl --resolve option is designed for precise control over DNS resolution during a specific HTTP transaction. Its syntax follows the pattern --resolve HOST:PORT:IP. For example, running curl --resolve example.com:443:93.184.216.34 https://example.com forces the connection to use the specified IP address for port 443, regardless of what the public DNS servers return. This is invaluable for testing SSL certificates on new IPs before propagating DNS changes or verifying backend connectivity.

When attempting to reproduce this in a browser, the goal is to achieve the same isolation: routing traffic for a specific domain to a specific IP while leaving all other internet traffic unaffected. Browsers typically rely on the operating system's resolver, which reads from local files or network-configured DNS servers. Therefore, the most reliable method involves manipulating these local resolution layers.

Modifying the Hosts File

The most universal way to force a browser to resolve a domain to a specific IP is editing the hosts file. This file acts as a local static DNS table with higher priority than external DNS queries. On Windows, this file is located at C:\Windows\System32\drivers\etc\hosts. On macOS and Linux, it resides at /etc/hosts.

  1. Open a text editor with administrative privileges. On Windows, right-click Notepad and select "Run as administrator." On Linux/macOS, use sudo nano /etc/hosts.
  2. Add a new line in the format: IP_ADDRESS DOMAIN_NAME. For instance, 93.184.216.34 example.com.
  3. Save the file and close the editor.
  4. Clear your browser's cache or perform a hard refresh (Ctrl+F5 or Cmd+Shift+R) to ensure the old DNS record is not used.

This method works across all browsers and platforms. It effectively reproduces the --resolve behavior globally for that domain until you remove the entry. If you need to test multiple endpoints simultaneously, consider using virtual machines or containers to isolate the host file modifications per environment.

Using Browser Developer Tools

For temporary debugging where editing system files feels too invasive, browser developer tools offer a programmatic workaround. Chrome and Edge allow you to override network requests using the Network panel. Open DevTools (F12), navigate to the Network tab, and enable "Preserve log." Right-click any request and select "Copy as fetch" or use the fetch() API in the Console tab.

You can manually construct a request with the desired IP if your network stack allows direct socket connections, but this is limited by CORS policies and browser security models. A more practical approach within DevTools is using the "Override" feature or extensions like ModHeader to manipulate headers, though this does not change the underlying IP resolution. For true IP substitution without system changes, proxy tools are often required.

Configuring Local Proxies

If you cannot modify the hosts file due to permission restrictions or need dynamic switching, a local HTTP proxy like mitmproxy or Fiddler can intercept and redirect traffic. Configure your browser to use http://127.0.0.1:8080 as its proxy. Then, set up a rule in the proxy tool to route requests for example.com to 93.184.216.34. This mimics the granular control of curl --resolve but adds latency and complexity. It is particularly useful for inspecting HTTPS traffic when combined with SSL stripping features.

Another lightweight alternative is using a browser extension dedicated to DNS management. Extensions like "SwitchyOmega" allow you to create profiles that route specific domains through different proxies or SOCKS5 servers, effectively achieving domain-specific resolution changes within the browser ecosystem.

Considerations for Testing

When reproducing curl --resolve behavior, remember that browsers enforce strict security checks. If the IP address presents a certificate mismatch for the domain name, the browser will block the connection unless you explicitly accept the risk via warnings. Unlike curl, which may proceed with -k or --insecure flags easily, browsers require user interaction to bypass certificate errors. Additionally, some modern web services employ HTTP/2 or QUIC protocols that may bypass standard proxy configurations, so always verify the protocol version being used in the Network tab.

Frequently Asked Questions

Does clearing the browser cache affect DNS resolution?

Yes, clearing the cache helps ensure the browser does not use a stale DNS response stored in memory. However, for permanent changes, you must update the hosts file or restart the DNS client service. Some browsers also maintain their own DNS cache, so restarting the browser entirely is often necessary after modifying system-level DNS settings.

Can I use curl --resolve directly in a browser extension?

No, curl is a standalone executable and cannot be run natively inside a browser extension. Extensions operate within the browser's sandbox and must use the Web Request API or proxy configurations to manipulate network traffic. You would need to build a custom extension that routes requests through a local proxy to achieve similar results.

What happens if the target IP does not support the requested domain?

The browser will attempt to connect to the IP, but the server may reject the connection or return a generic error page because the SNI (Server Name Indication) header sent by the browser does not match the server's configured certificates. This results in a certificate mismatch warning or a connection refused error, depending on the server configuration.

Is there a faster way to switch between IPs for testing?

Using a browser extension like SwitchyOmega is faster than editing the hosts file repeatedly. You can create multiple scenarios that point the same domain to different IPs and switch between them instantly from the browser toolbar. This avoids the need for administrative privileges or system reboots.

Why does my browser ignore the hosts file entry?

This usually occurs if another application overrides the DNS settings, such as a VPN client or corporate security software. Additionally, some browsers have experimental features enabled that bypass the system hosts file for performance reasons. Check your browser's internal flags (chrome://flags) for any DNS-related overrides and disable them.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More