So visiting https://www.whatismyip.com/ in the web browser (Google Chrome) shows your IPV4 address
But I get a completely different IP address If I inspect and get the code for the same POST request
I am connected to a [workplace] VPN, and the request via browser correctly recognizes the VPN provider and shows their IP address (which is what I want).
But if I make the same request from my cmdline (powershell for example), I get the IP address of the modem in my home.
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.112 Safari/537.36"
Invoke-WebRequest -UseBasicParsing -Uri "https://api.whatismyip.com/wimi.php" `
-Method "POST" `
-WebSession $session `
-Headers @{
"Accept" = "*/*"
"Accept-Encoding" = "gzip, deflate, br, zstd"
"Accept-Language" = "en-US,en;q=0.9,te;q=0.8"
"DNT" = "1"
"Origin" = "https://www.whatismyip.com"
"Referer" = "https://www.whatismyip.com/"
"Sec-Fetch-Dest" = "empty"
"Sec-Fetch-Mode" = "cors"
"Sec-Fetch-Site" = "same-site"
"sec-ch-ua" = "`"Chromium`";v=`"122`", `"Not(A:Brand`";v=`"24`", `"Google Chrome`";v=`"122`""
"sec-ch-ua-mobile" = "?0"
"sec-ch-ua-platform" = "`"Windows`""
}
Anyone know what kind of magic this is? I am looking to find the IP address of the VPN provider. TIA