Skip to content

Instantly share code, notes, and snippets.

@facelordgists
Last active September 3, 2019 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save facelordgists/736cdc2bd3ea363f6b5497bb1299bd50 to your computer and use it in GitHub Desktop.
Save facelordgists/736cdc2bd3ea363f6b5497bb1299bd50 to your computer and use it in GitHub Desktop.
Curl a website from one server to another within a private network, such as a gateway to appserver or loadbalancer to appserver.
# -H sets the header
# -v includes the header information
# /dev/null pipes the contents of the page output into a blackhole
curl -v http://<server-host_or_ip>/ -H "Host: domain.com" > /dev/null
# Example
curl -v https://localhost/ -H "Host: www.dentalmanagers.com" > /dev/null
curl -v http://appserver-4/ -H "Host: www.1111dental.com" > /dev/null
curl -v http://appserver-4/ -H "Host: test.roadsidedentalmarketing.com" > /dev/null
# View the HTML output
curl -v https://localhost/ -H "Host: www.dentalmanagers.com" | less
# Connect to loadbalancer (use HTTPS directly)
# Use HTTPS protocol, bypass cache
curl -v https://loadbalancer-production-alpha-1/ -H "Host: test.roadsidedentalmarketing.com" -H "X-Forwarded-Proto: https" -H "X-Cache-Bypass: true" --insecure > /dev/null
## see html returned
curl -v https://loadbalancer-production-alpha-1/ -H "Host: test.roadsidedentalmarketing.com" -H "X-Forwarded-Proto: https" -H "X-Cache-Bypass: true" --insecure | less
# Connect to app server using http with https added as a header
curl -v http://akkala-4/ -H "Host: test.roadsidedentalmarketing.com" -H "X-Forwarded-Proto: https" -H "X-Cache-Bypass: true" > /dev/null
## see html returned
curl -v http://akkala-4/ -H "Host: test.roadsidedentalmarketing.com" -H "X-Forwarded-Proto: https" -H "X-Cache-Bypass: true" | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment