Hey folks!
So, I was messing around with curl and wanted to figure out how to *curl print location header* from a response. Took me a bit to get it right, but here's what worked for me:
```bash
curl -s -o /dev/null -w "%{redirect_url}" http://example.com
```
Basically, the `-s` silences the progress stuff, `-o /dev/null` dumps the body (don’t need it), and `-w` lets you format the output to grab just the redirect URL.
If you’re dealing with a 3xx redirect, this should spit out the location header. Super handy for scripting or just checking where a URL’s headed.
Anyone got a cleaner way to *curl print location header*? Or maybe some edge cases I’m missing? Lemme know!
Cheers! 🍻
So, I was messing around with curl and wanted to figure out how to *curl print location header* from a response. Took me a bit to get it right, but here's what worked for me:
```bash
curl -s -o /dev/null -w "%{redirect_url}" http://example.com
```
Basically, the `-s` silences the progress stuff, `-o /dev/null` dumps the body (don’t need it), and `-w` lets you format the output to grab just the redirect URL.
If you’re dealing with a 3xx redirect, this should spit out the location header. Super handy for scripting or just checking where a URL’s headed.
Anyone got a cleaner way to *curl print location header*? Or maybe some edge cases I’m missing? Lemme know!
Cheers! 🍻
