-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meta data is missing from the Facebook preview when sharing a page or post which is cached #248
Comments
Hi there! I tried to reproduce it and didn't get the curl error. Reproduction steps:
The URL to the created page is: |
Thanks for checking, @angelocali. Did you enable the „Cache minify“ option? |
@krafit You’re welcome. My first attempt was without the „Cache minify“ option. I tried again with setting it to "HTML + Inline-JavaScript" and added a thumbnail to my post. I get slightly different results but still no curl error. |
This is coming from this support thread with more information shared. Just FYI: |
In the last reply @stklcode is recommending this potential fix:
If verified, this should be added to the documentation. @angelocali Maybe you can verify that those headers are provided in your case and that's why it is working for you? |
The screenshot by @angelocali looks fine to my eyes. The debugger accepts chunked content, so servers likely serve it partially, i.e. with several 206 responses. The encoding error by @markhowellsmead is reproducible, if pre-gzipped content is served from the .html.gz files without setting a proper According to the headers, @angelocali site is served by an nginx and correctly provides the There is no way the plugin itself can solve this problem programmatically. The documentation for the webserver config should be extended to ensure the correct behavior, if the pre-compressed content is used. Sidenote: |
I've checked this over again and tried the suggestion from @Zodiac1978 (adding the |
@markhowellsmead I tried this on https://developers.facebook.com/tools/debug/ with the URL provided on WordPress.org and clicked multiple times the "Scrape Again" button and always get the same correct answer. No curl error. In the header I don't see the correct encoding, it shows as Not sure why this does not work for you. Without reproducing the error, it is not easy to solve this. (The code snippet is from @stklcode - I just copied it from the WordPress.org thread.) |
@Zodiac1978 I'd commented out the problematic htaccess code so that the sharing wasn't broken. If you try it now, you'll see the error. (I've temporarily set it back to the standard htaccess code from the documentation.) |
Additional: if I call the the cached page (link in the WordPress.org thread) with the following htaccess rules active, then the page doesn't render in the browser.
|
@markhowellsmead The gzip part is not necessary. Like @stklcode wrote:
The server is using the Brotli algorithm for compression, which is a successor to gzip. See: If the GZIP lines are not used you are serving just HTML which is compressed "on-the-fly" by your server with Brotli. Faster and smaller than gzip. Everything is fine. No need to fix anything, because nothing is broken. IF you want to enable the GZIP part (I don't know why, because there is nothing broken ...) you need to set the encoding to GZIP if you serve pre-gzipped files. The Obviously your server doesn't want to let you change the You can try this:
If the module for changing headers is not available the code is not executed and therefore nothing should break anymore. But also the In this case there is nothing to solve for us. If we can't change it, it will not work. You can ask your hoster, but as said above: Brotli is better and is used "on-the-fly". Why change that? The only thing to "fix" is, you don't need those Hopefully this explanation now clarifies what happened. :) @stklcode Please correct me if I am wrong here in something. |
It serves the “best“ encoding that is acceptable before both sides (client sends an indicating header This is how we currently document the behavior for Apache httpd:
There are several reasons why this might not work, depending on the server configuration. Not all flags are allowed to override in .htaccess and that is configurable. Worst-case the content mit be double-compressed, if the server does not detect the type and applies gzip/br/deflate again.
+1 |
The quoted code doesn't appear in the documentation at https://cachify.pluginkollektiv.org/documentation/, and it also produces the same cURL error. The following code in htaccess seems to work both for the browser version and for the Facebook debugger:
|
Copied from the “setup“ tab content in the plugin config. Apparently that’s what we “recommend“ there. Should be unified with the more elaborate web documentation. |
Agree, although the code in the setup tab leads to the cURL error, so is currently unusable for all of our projects. |
The meta data is missing from the Facebook preview when sharing a page or post which is cached. The Facebook Debugger shows the error message Curl error: 61 (BAD_CONTENT_ENCODING).
I copied out the HTML content to a static file in the webroot and shared this URL; it was correctly interpreted. Therefore, the content delivery from the cache is causing a problem. I traced the problem back to the following rules in the .htaccess file. If I comment these out, the Facebook Debugger can load the content correctly.
To Reproduce
Expected behavior
The usual Facebook preview of meta data (including post thumbnail) should be shared. The preview in the Facebook Debugger should not return any errors.
System (please complete the following information):
The text was updated successfully, but these errors were encountered: