Jayanth Suvarna
Jayanth Suvarna

Reputation: 187

Facebook share shows main server IP address instead of domain name

I implemented social sharing features to application

We have load balancer set up which forwards all requests to main server so problem is Facebook sharing happening , but it shows IP address of main server .

Please suggest me how to remove IP address and show subdomain

enter image description here

Upvotes: 2

Views: 864

Answers (2)

Jayanth Suvarna
Jayanth Suvarna

Reputation: 187

I found the solution , It was redirection issues , When the request redirects from one server to another server , it should be redirected without changing the url or to any ip address . It could be achieved like below

If the Redirection happens using virtual host file we can have

ex:

ProxyPass "http://test.example.com/"

If the Redirection happens using .htacess we can have

ex:

RewriteCond %{HTTP_HOST} ^(www\.)?test.com\\.com$ [NC] RewriteRule ^ http://test.com/test%{REQUEST_URI} [L,NE,P]

Since the rewrite engine loops through all the rules until the URI stops changing, the L flag will not prevent the looping, only any further rules from getting applied in the current iteration.

Upvotes: 1

Drop Shadow
Drop Shadow

Reputation: 808

Use the following meta tag for facebook share

<meta property="og:image" content="" />
<meta property="og:url" content="" />
<meta property="og:title" content="" />

I think your problem will be solved.

Upvotes: 1

Related Questions