Yoast / Yoast-SEO-for-TYPO3

Yoast SEO plugin for TYPO3
Other
51 stars 56 forks source link

The server was not able to access the page to analyse your content (status code 500) #528

Closed cdaecke closed 1 year ago

cdaecke commented 1 year ago

Please give us a description of what happened.

When selecting a normal page in the TYPO3 backend, I do not get the expected Yoast preview snippet, but the following error:

**The server was not able to access the page to analyse your content**
When trying to fetch https://myurl.ddev.site/page1/page1/, a 500 status code was received. Please make sure your server can access the page.
Bildschirmfoto 2023-02-26 um 20 42 38

Looking for a solution, i found out, that the preview works perfektly fine, when I change the following line https://github.com/Yoast/Yoast-SEO-for-TYPO3/blob/6ce23d61c91afa5adf71e15b54c1e9aa2fd95511/Classes/Service/PreviewService.php#L81

to this:

'HTTP_X_YOAST_PAGE_REQUEST' => GeneralUtility::hmac(

I came across this, because the YoastReguestHash checks against an uppercase phrase and underscores:

https://github.com/Yoast/Yoast-SEO-for-TYPO3/blob/6ce23d61c91afa5adf71e15b54c1e9aa2fd95511/Classes/Utility/YoastRequestHash.php#L16-L22

To be honest, the strange part is, that the extension works without changes in another website without any problems and I do not see the difference... But at least the change above does not break the functionality in the working website :-)

Technical info

BeMarcss commented 1 year ago

To be honest, the strange part is, that the extension works without changes in another website without any problems and I do not see the difference...

Did you check your php Version on both systems? I got the same error, and it seems to occur on php 8.1 only. Just tested it with php 7.4 & 8.0 and it worked.

cdaecke commented 1 year ago

I have now tested with a fresh system on PHP v7.4, v8.1 and even v8.2. All working without any problems...?!

abvdveen commented 1 year ago

@cdaecke: do you use env variables in your config/sites/site_name/config.yaml? I came across your issue as I have the same problem on my sites. The 500 error that's generated in my case is:

cURL error 6: Could not resolve host: ahk-%env(dev_context)%.netklaar.amsterdam

caused by using this env var in config.yaml:

base: 'https://reinwardt-%env(DEV_CONTEXT)%.netklaar.amsterdam/'

Changing the header as you did, to HTTP_X_YOAST_PAGE_REQUEST fixes the problem - although it's not a real fix ofcourse, as it should be possible to use env vars in the config.yaml

cdaecke commented 1 year ago

It seems, that the current version 9.0.0 of ext:yoast_seo solves the problem.

abvdveen commented 1 year ago

@cdaecke: thanks for the info, it does indeed.

cdaecke commented 1 year ago

So this issue can be closed.

Thanks again for the extension and your work!