Project

General

Profile

Actions

Bug #90228

closed

Typolink: Forcing absolute url scheme does not work

Added by Mario Lubenka over 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Start date:
2020-01-28
Due date:
% Done:

100%

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

Description

According to documentation it is possible to force a url scheme (like https) as below:

page.1 = TEXT
page.1.typolink.parameter = 2
page.1.typolink.returnLast = url
page.1.typolink.forceAbsoluteUrl = 1
page.1.typolink.forceAbsoluteUrl.scheme = https

However the generated URL still only has the http protocol.

Looking into the PageUrlBuilder the corresponding line $url = $this->forceAbsoluteUrl($url, $conf); is only run for access-restricted pages.

Applying that to all urls by moving it down a line works for the scheme.
However the RegEx that is used seems to miss out on the / between base url and path.
So instead of "https://mypage.site/home" it generates "https://mypage.sitehome".

This RegEx seems to work better: #^(?:([a-z]+)(://)([^/]*)(/?))?(.*)$# (see RegEx in action)

I only tested this for TYPO3 9.5.13. Might affect 8.7 as well.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #95796: Protocol is missing in absolute URLsClosed2021-10-27

Actions
Actions #1

Updated by Mario Lubenka over 4 years ago

  • Description updated (diff)
Actions #2

Updated by Mario Lubenka over 4 years ago

So... simply moving the "forceAbsoluteUrl" seems to break Frontend rendering. :(
And the new RegEx might not be necessary. It might be enough to add the missing / before the path.

Actions #3

Updated by Gerrit Code Review about 4 years 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/+/63252

Actions #4

Updated by Gerrit Code Review about 4 years 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/+/63252

Actions #5

Updated by Thomas Oliver Moll almost 4 years ago

Hi, is this patch complete?

As I read the bugreport PageUrlBuilder should also be modified not just AbstractTypolinkBuilder.php

I experience this problem in 9.5.17:

 stdWrap.typolink{
      returnLast = url
      forceAbsoluteUrl = 1
      forceAbsoluteUrl.scheme = https
      parameter.data = page:uid
      parameter.wrap=|,9818
      addQueryString = 1
      addQueryString.exclude = id,cHash,no_cache
      addQueryString.method = GET
      useCacheHash = 1
      no_cache = 0
  }

Or do I have to alter my typoscript?

Actions #6

Updated by Gerrit Code Review almost 4 years 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/+/63252

Actions #7

Updated by Gerrit Code Review almost 3 years 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/+/63252

Actions #8

Updated by Gerrit Code Review almost 3 years 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/+/63252

Actions #9

Updated by Gerrit Code Review almost 3 years 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/+/63252

Actions #10

Updated by Gerrit Code Review almost 3 years ago

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

Actions #11

Updated by Nikita Hovratov almost 3 years ago

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

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed
Actions #13

Updated by Georg Ringer over 2 years ago

  • Related to Bug #95796: Protocol is missing in absolute URLs added
Actions

Also available in: Atom PDF