print "Status: 302 Found\n";
print "Location: $url\n\n";
i would be looking at "the visit" in the server access log file for cluesFor the lost clicks, there is never a visit anywhere following the redirect.
HTTP/1.1 302 Found
Date: Tue, 09 Jul 2013 16:51:31 GMT
Server: Apache/2.2.3 (CentOS)
Set-Cookie: tpid=3751430_53174; path=/
Location: http://www.example.com
Cache-Control: max-age=0
Expires: Tue, 09 Jul 2013 16:51:31 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=2
Connection: Keep-Alive
Content-Type: text/html
For the lost clicks, there is never a visit anywhere following the redirect.
I've pored over the headers, but can't see anything that would be amiss
Someone clicks the link
There's really no "rest" of the visit.
Link A redirects to Link B using a 302 status. Link A has no CSS or images.
When you add a Content-Type header to a redirect, it considers the 302 to be a html page- no redirect is performed.
Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).
302's are temporary so I don't see the value in using Vary or Set-Cookie on them if you can help it.
This response is only cacheable if indicated by a Cache-Control or Expires header field.
Content-Type is standards with a redirect, but if it ends in two newlines and it is served before the Location header, it will be treated as a HTML page
I'm just pointing out that it would be more efficient to serve those headers on the page the user-agent is redirected to. That way if a user-agent directly accesses the page without a redirect, it will be served the proper headers.