Use of twitter card with redirection


#1

I’m trying to post using a URL (i.e. abc.com) that redirects to the final destination url (i.e. cnn.com).
The issue that I’m seeing is that the twitter card is not showing up (the twitter post becomes just a text with the URL but with no image).

I tried validating the URL using the card validator and it says it’s not whitelisted. In the case that abc.com doesn’t have any images to be scraped, but only the one on cnn.com needs to be scraped, does abc.com still need to be whitelisted?


#2

The white listing message is misleading - check the troubleshooting post Not Whitelisted, unable to render, or no image: READ THIS FIRST


#3

Thanks. Do you know if the twitter card walks through all the redirections to the last url? Right now the abc.com is returning 302. That shouldn’t be a problem for twitter card to keep redirecting until it goes to 200 right?


#4

You should see message about the redirection in the validator if that is working. As mentioned in the post we would need a URL to be shared to verify.


#5

sample url - https://dlt.vitrue.com/dynamic_links/86851?cid=1&t=https%3A%2F%2Fhbr.org%2F2017%2F01%2Fexecutives-and-salespeople-are-misaligned-and-the-effects-are-costly&abc=d&x=y&pn=postname&id=6809459&cpid=223


#6

When fetched using curl that page returns an HTML page with status 200. The page contains JavaScript that apparently does the redirect. There are no cards tags. The cards crawler cannot execute JavaScript so this will not work.


#7

When I run curl -v https://dlt.vitrue.com/dynamic_links/86851?cid=1&t=https%3A%2F%2Fhbr.org%2F2017%2F01%2Fexecutives-and-salespeople-are-misaligned-and-the-effects-are-costly&abc=d&x=y&pn=postname&id=6809459&cpid=2231,

< HTTP/1.1 302 Found

  • Server nginx/1.4.2 is not blacklisted
    < Server: nginx/1.4.2

it returns 302.
And if you access this page directly on the browser, it takes you to hbr.org. So in the end it’s redirecting to https://hbr.org/2017/01/executives-and-salespeople-are-misaligned-and-the-effects-are-costly.

So the reason why it’s not able to create the twitter card is because the twitterbot will not follow the redirection if it’s in the javascript? (found this post - Javascript redirection will not work for the Twitterbot?)


#8

Can you check this one?
It should redirect it to www.cnn.com without using javascript.

curl -v https://dlt.srm-integration.pp1.oraclecloud.com/dynamic_links/138?t=http%3A%2F%2Fwww.cnn.com

  • Trying 160.34.176.5…
  • Connected to dlt.srm-integration.pp1.oraclecloud.com (160.34.176.5) port 443 (#0)
  • TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • Server certificate: *.srm-integration.pp1.oraclecloud.com
  • Server certificate: Symantec Class 3 Secure Server CA - G4
  • Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5

GET /dynamic_links/138?t=http%3A%2F%2Fwww.cnn.com HTTP/1.1
Host: dlt.srm-integration.pp1.oraclecloud.com
User-Agent: curl/7.48.0
Accept: /

< HTTP/1.1 301 Moved Permanently
< Server: nginx
< Date: Wed, 08 Feb 2017 22:52:47 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 0
< Connection: close
< Location: http://www.cnn.com
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Set-Cookie: BIGipServer~Public~shop.srm-integration_pp1_oraclecloud_com_80=rd2o00000000000000000000ffff0a566e96o80; path=/
<

  • Closing connection 0

that one seems work.


#9

Is there any workaround that we can make the cards crawler execute? Since we have to use javascript to tracking some data.


#10

I ran curl with the Twitterbot user-agent and I see something different. Either way, yes, Twitterbot cannot run JavaScript.

You will have to have a static HTML shim with card tags if you want to achieve this.


#12

Do you have some examples, how can I do using card tags?


#13

The cards documentation describes the format of meta tags required.


#14

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.