简体   繁体   中英

Facebook shared link does not open in FB iOS App in-app browser

We have a website deployed in a Ubuntu 14 server running Apache. The website uses an SSL certificate (so you can access through https) and has a redirection for all the incoming requests without https.

Ok, so the website is working as expected in desktop browsers and mobile browsers, but, when users tap on the links (from the Facebook iOS app) the in-app browser tries to open the website and returns a message like "Link doesn't work, try again" (not the exact message in english).

After a lot of research I still don't have a clear idea of what this can happen (just found a couple of unresolved cases on google), so I'd start by looking at the server configuration.

The apache configuration (IP and domains are samples):

<VirtualHost 200.200.200.200:80>
    ServerName www.domain.com
    Redirect permanent / https://www.domain.com/
</VirtualHost>

<VirtualHost domain.com:80>
    ServerName www.domain.com
    Redirect permanent / https://www.domain.com/
</VirtualHost>

<VirtualHost www.domain.com:443>
    ServerName www.domain.com
    ServerAlias domain.com

    SSLEngine on
    SSLCertificateFile /home/ssl/www.domain.com.crt
    SSLCertificateKeyFile /home/ssl/domain.com.key

    ServerAdmin admin@domain.com
    DocumentRoot /var/www/html
    <Directory /var/www/html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

The .htaccess file:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

The previous configuration works fine in all browsers, it just doesn't load (doesn't even makes it to Apache access log) when loaded with Facebook iOS in-app browser.

Help is much appreciated! Thanks in advance for your time.

After analyzing the url with the SSL Checker suggested by @CBoroe, I find out that there was a missing intermediate certificate configuration that needed to be added because we're using Apache < 2.4.8 version.

We just had to add the SSLCertificateChainFile /home/cert_ssl/intermediate.crt directive. The final SSL part of the code looks like this:

SSLEngine on
SSLCertificateFile /home/ssl/www.domain.com.crt
SSLCertificateKeyFile /home/ssl/domain.com.key
SSLCertificateChainFile /home/ssl/intermediate.crt

Hope this helps someone else having this issue. After this change, restart Apache with:

service apache2 restart

And everything should work fine (you can use the same SSL checker tool to validate it).

Thanks for your time!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM