Skip to content
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

Redirect loop while viewing live version when using a preview workspace (TYPO3 7.6.5, realurl 2.0.14) #154

Open
sascha-schieferdecker opened this issue May 4, 2016 · 7 comments
Labels

Comments

@sascha-schieferdecker
Copy link

sascha-schieferdecker commented May 4, 2016

Steps to reproduce:

  1. Switch to non-admin user (or login as non-admin user)
  2. Switch to a non live workspace
  3. Preview a page in workspace
  4. Open a second browser tab with the live version (e.g. www.domain.com)

In the opened browser window of the live version you'll end up in a redirect loop, because the deactivation of generating links doesn't work. We tried to solve it in Typoscript via

[globalVar = TSFE : beUserLogin > 0]
config.tx_realurl_enable = 0
[global]

which is basically what realurl does on it's own. The thing is, in the newly opened browser tab realurl doesn't seem to notice we are in a workspace and generates the links anyway instead of deactivating the generation.

@dmitryd
Copy link
Owner

dmitryd commented May 4, 2016

Limitations:

_2. RealURL does not support workspaces

Enabling the extension

By default the extension is disabled and will not encode URLs. It will still decode URLs but the encoding must be enabled with the following TypoScript setup option:

config.tx_realurl_enable = 1

Conclusion: please, read docs before posting something as a bug.

The behavior you describe is expected because RealURL does not support workspaces. When you are logged in to BE, RealURL will attemot to detect if it runs in a workspace and will not try to decode the URL. The code for this exist but was not tested. So I cannot guarantee that it always works.

@dmitryd
Copy link
Owner

dmitryd commented May 4, 2016

In addition:

in the newly opened browser tab realurl doesn't seem to notice we are in a workspace and generates the links anyway instead of deactivating the generation.

This means that the new browser tab does not get a BE user login. Unfortunately I cannot do anything about it. The code relies on the ability of TYPO3 core to identify the BE user.

Ideas are welcome.

@dmitryd dmitryd added the on hold label May 6, 2016
@sascha-schieferdecker
Copy link
Author

I read the docs, and I understand the way realurl works. The behaviour we want to achive is the deactivation of the encoding, which works fine if previewing a workspace. The problem is the newly opened tab, where the editor wants to look up something in the live workspace and you end in a redirect loop. I will post this to the core bugtracker then. Maybe our posted workaround helps someone coming here and having the same problem.

@dmitryd
Copy link
Owner

dmitryd commented May 9, 2016

Probably you can add a TS condition and disable realurl with that condition.

@christophlehmann
Copy link
Contributor

Similiar problem here: An editor works in workspace only of domain1. Opening domain2 in another tab (which he don't see in the backend) leads to an infinite 307 Redirect.

The condition

[globalVar = TSFE : beUserLogin > 0]
config.tx_realurl_enable = 0
[global]

does not work for us. The redirect is done in typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:3077

        // Prevent redirection loop
        if (!empty($redirectUrl)) {
            // redirect and exit
            HttpUtility::redirect($redirectUrl, HttpUtility::HTTP_STATUS_307);
        }

The block seems somehow wrong to me since $redirectUrl is not checked against $_SERVER['REQUEST_URI']. When i change the line

if (!empty($redirectUrl)) { to if (!empty($redirectUrl) && '/' .$redirectUrl !== $_SERVER['REQUEST_URI']) { it really prevents a redirect loop and shows the page he likes to see.

Would someone discuss it or should we open a ticket at forge?

@christophlehmann
Copy link
Contributor

I opened a ticket, see https://forge.typo3.org/issues/82297

@christophlehmann
Copy link
Contributor

@sascha-schieferdecker Can you test and review https://review.typo3.org/#/c/53977/ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants