Bug #86935

Cannot fetch 404 page with simple base

Added by Mathias Brodala 12 months ago. Updated 5 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Start date:
2018-11-15
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you set up the errorHandling in a site configuration to use the errorHandler: Page and a dedicated page as errorContentSource this page cannot be displayed if you use a base without a full URL like / or /en/ (for language variants)

The following error is displayed as HTML response in this case:

Error handler could not fetch error page: Possible recursion detected.

There are many problems with this error message itself:

  • It does not contain the internally resolved URL
  • It does not contain the exact error message which occurred

In this very case a errorContentSource like t3://page?uid=10 is resolved to /404 (if that's the slug of the 404 page) by the PageContentErrorHandler. Then GeneralUtility::getUrl() tries to load this as a file called /404 in the filesystem of the web server since the resolved URL does not contain a scheme and host. At least this additional error could be avoided by using the RequestFactory directly.

The error itself should be fixed by prepending the current scheme and host in case the resolved URL is not a full URL. The PageContentErrorHandler only supports pages and full URLs anyways. This could make it necessary to add an additional StaticFileErrorHandler to cover cases where displaying content of a static file really was intended.


Related issues

Related to TYPO3 Core - Task #87073: Optimize error message of handlePageError() Closed 2018-12-04
Related to TYPO3 Core - Bug #86616: Content of 404 page is not shown Needs Feedback 2018-10-10
Related to TYPO3 Core - Bug #86260: Site error handling: Show content from page with / entry point Accepted 2018-09-15
Related to TYPO3 Core - Feature #88361: Site error handling: "Show content from page" for 404 should render page directly Accepted 2019-05-15

Associated revisions

Revision c4a144e6 (diff)
Added by Andreas Fernandez 5 months ago

[BUGFIX] Use scheme://host:port of current request resolving error page

Error pages in site configurations don't need to point to an absolute URI.
When such error pages get resolved, the scheme, host and port of the
request get attached to the resolved page.

Resolves: #86935
Releases: master, 9.5
Change-Id: I1b29b7e7ec51c67e6630ed0f2de5f7e3276e8e7d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630
Reviewed-by: Jörg Bösche <>
Reviewed-by: Mathias Brodala <>
Reviewed-by: Tizian Schmidlin <>
Reviewed-by: Benni Mack <>
Tested-by: TYPO3com <>
Tested-by: Tizian Schmidlin <>
Tested-by: Benni Mack <>

Revision e7df51d1 (diff)
Added by Andreas Fernandez 5 months ago

[BUGFIX] Use scheme://host:port of current request resolving error page

Error pages in site configurations don't need to point to an absolute URI.
When such error pages get resolved, the scheme, host and port of the
request get attached to the resolved page.

Resolves: #86935
Releases: master, 9.5
Change-Id: I1b29b7e7ec51c67e6630ed0f2de5f7e3276e8e7d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60873
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Peter Kraume 12 months ago

  • Related to Task #87073: Optimize error message of handlePageError() added

#2 Updated by Wolfgang Wagner 11 months ago

Problem still exists in 9.5.3

#3 Updated by Benjamin Schmidt 10 months ago

Problem still exists in 9.5.3 - i can confirm.
Workaround: Just point to your 404 page by URL, this works.

#4 Updated by Christian Hackl 9 months ago

Benjamin Schmidt wrote:

Problem still exists in 9.5.3 - i can confirm.
Workaround: Just point to your 404 page by URL, this works.

and how do you do this?
(TYPO3 9.5.4)

#5 Updated by Mathias Brodala 9 months ago

Christian Hackl wrote:

Benjamin Schmidt wrote:

Problem still exists in 9.5.3 - i can confirm.
Workaround: Just point to your 404 page by URL, this works.

and how do you do this?
(TYPO3 9.5.4)

Use a full URL like https://example.org/404 and use environment variables if necessary.

#6 Updated by Christian Hackl 9 months ago

Mathias Brodala wrote:

Christian Hackl wrote:

Benjamin Schmidt wrote:

Problem still exists in 9.5.3 - i can confirm.
Workaround: Just point to your 404 page by URL, this works.

and how do you do this?
(TYPO3 9.5.4)

Use a full URL like https://example.org/404 and use environment variables if necessary.

Ah thanks

#7 Updated by Niklas Lazinbee 8 months ago

The Problem still exists in 9.5.5

Just point to your 404 page by URL

This don't work for me?

#8 Updated by Attila Glück 8 months ago

hi, you must set a full base url in config.yaml https://domain.com/ than works.

#9 Updated by Niklas Lazinbee 8 months ago

Okay, the problem is, I protected the website width htacess password. Without the protection the solution with the url works.

#10 Updated by Riccardo De Contardi 8 months ago

Are these issues related?

#86616

#86260

#11 Updated by Mathias Brodala 8 months ago

Riccardo De Contardi wrote:

Are these issues related?

#86616

#86260

Yes, sounds like, please mark them accordingly.

#12 Updated by Riccardo De Contardi 8 months ago

  • Related to Bug #86616: Content of 404 page is not shown added

#13 Updated by Riccardo De Contardi 8 months ago

  • Related to Bug #86260: Site error handling: Show content from page with / entry point added

#14 Updated by Alexander Grein 7 months ago

Is it also possible to show 404 pages for different languages using the absolute url trick?

#15 Updated by Gerrit Code Review 7 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630

#16 Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630

#17 Updated by Gerrit Code Review 7 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630

#18 Updated by Gerrit Code Review 6 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630

#19 Updated by Benni Mack 6 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

#20 Updated by Stefan Neufeind 6 months ago

  • Related to Feature #88361: Site error handling: "Show content from page" for 404 should render page directly added

#21 Updated by Gerrit Code Review 6 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630

#22 Updated by Gerrit Code Review 6 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60630

#23 Updated by Gerrit Code Review 5 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60873

#24 Updated by Andreas Fernandez 5 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF