Project

General

Profile

Actions

Bug #82939

closed

absRefPrefix ignored for shortcut redirects (and probably also mountpoints)

Added by Andreas Allacher over 6 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2017-11-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Only tested with 7 but the code didn't change so the issue should still exist.
Currently in "TYPO3\CMS\Frontend\Http\RequestHandler"
$this->controller->checkPageForShortcutRedirect();
is executed before
$this->controller->preparePageContentGeneration();
where $this->controller->absRefPrefix / $GLOBALS['TSFE']->absRefPrefix is set.
which results in the redirect link that is generated by typolink to ignore any set absRefPrefix and just append the current domain / directory information.

This realurl issue: https://github.com/dmitryd/typo3-realurl/issues/548
is also related.

Actions #1

Updated by Johannes Engel over 6 years ago

  • TYPO3 Version changed from 7 to 8

I can confirm this bug still exists in version 8.7.8.

Actions #2

Updated by Andreas Allacher over 6 years ago

Edit to above in 7.6 the method where the absRefPrefix is set was PageGenerator::pagegenInit();
However, otherwise the issue is the same.

Actions #3

Updated by Daniel Goerz over 6 years ago

For everybody coming here because of a flooded typo3.log by realurl:

You can deactivate the logging of warnings from the class with

$GLOBALS['TYPO3_CONF_VARS']['LOG']['DmitryDulepov']['Realurl']['Encoder']['writerConfiguration'] = [
        \TYPO3\CMS\Core\Log\LogLevel::WARNING => []
];

Actions #4

Updated by Markus Klein over 6 years ago

  • Category changed from Frontend to Link Handling, Site Handling & Routing
  • Status changed from New to Needs Feedback

So the question really is, is this a bug?
Fixing this would require to evaluate the full TS for the shortcut page in order to get the proper configuration.

Do you actually have a use case where this breaks for you?
(besides that realurl does complain, but it works?)

Actions #5

Updated by Bernhard Eckl over 6 years ago

Same here.

Sure it is a bug (a bug is not only a bug if it breaks something). The warning message appears but the config option is set. This leads to flooding log messages. And the flooding just took my website down because the log was not rotated and had 30 GB and then the partition was full -> site broken. Deactivating the log messages is a good workaround but not a solution.

Actions #6

Updated by Andreas Allacher over 6 years ago

@Bernhard Eckl: I think that is actually an issue with realurl that it does log every single instance here. Especially, if you don't set absRefPrefix it will log every link occurence and not just per request.

Regarding the bug itself:
It is a bug because why do we allow the user to set absRefPrefix otherwise?
For instance, the absRefPrefix could be a different domain - probably not very likely to happen but it could happen.

Also: At this point - meaning when

\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::checkPageForShortcutRedirect

is called, the absRefPrefix value:
$this->config['config']['absRefPrefix']

has already been initialized.

I am not sure which page it is initialized for but I think for the page that does the redirect which I think should be enough in 99% of the cases?

However, it is true that we won't have the absRefPrefix of the shortcut page but
I checked with Xdebug.

Actions #7

Updated by Markus Klein over 6 years ago

@Eckl:

IMO you are mixing causalities here. Only because realurl reports some "missing configuration" it does not mean this is a bug in the core. Maybe it's intended that TS is not evaluated at this point?

I'm sorry for you that your site went down due to logging, but honestly, this is a matter of wrong server setup (missing rotation, missing monitoring, not checking logs after updating extensions).

The warning by realurl is for sure a thing that is meant to hint the integrator towards a possible wrong configuration of the system. It does not mean that this is always true.

As I said, from my first glimpse at the code I can say that changing the core to deliver fully parsed TS at this point during request handling might (or rather will) have quite a performance impact and is (unfortunately) horrible to test.
I therefore kindly ask for a concrete use case, where this actually breaks functionality. Because if nothing is broken then the log message probably is wrong - which my current point of view is.

Actions #8

Updated by Markus Klein over 6 years ago

Note: Anybody is of course welcome to provide a core fix!

Actions #9

Updated by Andreas Allacher over 6 years ago

@Markus: The template seems to be parsed at that point and the config option is available.
I think it is parsed for the page with the ID that does the redirect but I think that is OK.
After all by default URLs are generated for the page that creates them.

A use case would be to modify the domain to redirect to, it should probably be done by domain entries before that but... I think in general since the "auto" option the reason for being able to set absRefPrefix is quite limited.

Actions #10

Updated by Markus Klein over 6 years ago

I think it is parsed for the page with the ID that does the redirect but I think that is OK.

Interesting finding and yet hard to decide whether this is correct or not. But it should be okay to assume it is correct due to lack of better knowledge.

Can you provide a patch Andreas?

Actions #11

Updated by Andreas Allacher over 6 years ago

I can. Will probably do so tomorrow or over the weekend.
One thing: Just above the shortcut redirect it does a similar thing for mountpoints.
Probably best to initialize it before that one as well?

Actions #12

Updated by Markus Klein over 6 years ago

Mountpoints do not redirect, I guess this is not needed there?

Actions #13

Updated by Andreas Allacher over 6 years ago

Ah. The method is actually afterward. Not sure regarding redirect but the method is called: checkPageForMountpointRedirect. I think if one accesses the mountpoint page itself it redirect automatically to add the relevant MP parameters?

Actions #14

Updated by Markus Klein over 6 years ago

Hm... I would need to give this a try. Haven't used mount points for a very long time.

Actions #15

Updated by Andreas Allacher over 6 years ago

Just as information: I wasn't able to look at this during the weekend. And I am not sure when I will find the time to do this now. I will try next weekend but no guarantees.

Actions #16

Updated by Christian Toffolo over 6 years ago

I met the same problem and reported it here: https://github.com/dmitryd/typo3-realurl/issues/570

I quote here my suggestion:
"I can't find a way to let Realurl to know that the encode link request comes from a shortcut page. Maybe is the core that should set absRefPrefix to NULL as default instead of '' until its value is really set later."

Could it be a solution to default absRefPrefix to NULL?

Actions #17

Updated by Christian Huppert over 6 years ago

I can confirm that this happens in our TYPO3 CMS 7.6.23 installation when calling a shorcut page even if config.absRefPrefix is set. In our case config.absRefPrefix is set to "/".

Actions #18

Updated by Christian Huppert over 6 years ago

I would like to notify you that the discussion about this continues here: https://github.com/dmitryd/typo3-realurl/issues/577#issuecomment-355924387
The extension author (Dimitry Dulepov) asks here if the fix should take place in the core.

Actions #19

Updated by Alexander Opitz almost 6 years ago

  • Status changed from Needs Feedback to New
Actions #20

Updated by Susanne Moog over 5 years ago

  • Sprint Focus set to On Location Sprint
Actions #21

Updated by Benni Mack over 4 years ago

  • Status changed from New to Needs Feedback

Hi Everybody,

I guess this one is now solved in TYPO3 v9? We now respect linkVars and absRefPrefix, and have Site Routing in place where we have all the "full" URLs we need.

Actions #22

Updated by Susanne Moog over 4 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #23

Updated by Benni Mack over 4 years ago

  • Status changed from Needs Feedback to Closed

This was fixed in RealURL (see https://github.com/dmitryd/typo3-realurl/issues/577) and solved in TYPO3 v9 with native Routing Support. I will close this issue now. If you feel otherwise, let me know, and I will re-open the ticket.

Actions

Also available in: Atom PDF