Last active
August 17, 2023 15:39
-
-
Save RichardBronosky/363811de1030f85e55b0ab020cf043e7 to your computer and use it in GitHub Desktop.
A oneliner for testing redirects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # The following line defines a bash function and is designed to be copy-pasta-ed into your terminal and used as shown on the last line of this file. I'm only putting it in a script to get it on gist | |
| redir_test(){ curl -svLo /tmp/redir_test.out "$@" 2>&1 | grep -E '^(> Host|> GET|< HTTP|< location|[<>]\s*$)'; } | |
| # BONUS: One super-useful use of this is to test your readiness to respond to future DNS changes. That can be done like so: | |
| # redir_test -H 'Host: www.example.com' https://192.168.0.101/ | |
| # This assumes that your server at 192.168.0.101 is set up to serve www.example.com and this simulates what `curl https://www.example.com/` would do if DNS returned 192.168.0.101 when doing a lookup on www.example.com | |
| redir_test "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment