title: How to retrieve the real redirect location header with Curl? without using {redirect_url}
body: <p>I realized that Curl {redirect_url} does not always show the same redirect URL. For example if the URL header is<code>Location: https:/\example.com</code> this will redirect to <code>https:/\example.com</code> but curl {redirect_url} shows <code>redirect_url: https://host-domain.com/https:/\example.com</code> and it won't display the response real location header. (I like to see the real <code>location:</code> result.)</p>
  
  <p>This is the BASH I'm working with:</p>
  
  <pre><code>#!/bin/bash
  # Usage: urls-checker.sh domains.txt
  FILE="$1"
  while read -r LINE; do
       # read the response to a variable
       response=$(curl -H 'Cache-Control: no-cache' -s -k --max-time 2 --write-out '%{http_code} %{size_header} %{redirect_url} ' "$LINE")
       # get the title
       title=$(sed -n 's/.*&lt;title&gt;\(.*\)&lt;\/title&gt;.*/\1/ip;T;q'&lt;&lt;&lt;"$response")
       # read the write-out from the last line
       read -r http_code size_header redirect_url &lt; &lt;(tail -n 1 &lt;&lt;&lt;"$response")
       printf "***Url: %s\n\n" "$LINE"
       printf "Status: %s\n\n" "$http_code"
       printf "Size: %s\n\n" "$size_header"
       printf "Redirect-url: %s\n\n" "$redirect_url"
       printf "Title: %s\n\n" "$title"
       # -c 20 only shows the 20 first chars from response
       printf "Body: %s\n\n" "$(head -c 100 &lt;&lt;&lt;"$response")"
  done &lt; "${FILE}"
  </code></pre>
  
  <p>How can I <code>printf "Redirect-url:</code> the original requested <code>location: header</code> without having to use <code>redirect_url</code>?</p>