rest icon indicating copy to clipboard operation
rest copied to clipboard

Exception when applying the default configuration.

Open 4allportaleabdullah opened this issue 10 months ago • 3 comments

Hi, I am encountering the following exception when trying to test with version 12+. I have used v4 and v5 before with no problems.

I know that v6 has not been released yet, but can you tell if this is a misconfiguration or a bug?

Thank you in advance.

Branch: v6 Typo3-Version: 12.4.11 Default configuration as described in : https://rest.corn.rest/Configuration/

Core: Exception handler (WEB): Uncaught TYPO3 Exception: TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::__construct(): Argument #2 ($site) must be of type TYPO3\CMS\Core\Site\Entity\Site, TYPO3\CMS\Core\Site\Entity\NullSite given, called in /var/www/html/typo3_src-12.4.11/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 2985 | TypeError thrown in file /var/www/html/typo3_src-12.4.11/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php in line 524. Requested URL: http://host.docker.internal:8080/rest/virtual_object-gallery/ Delete similar errors

4allportaleabdullah avatar Apr 02 '24 09:04 4allportaleabdullah

I think the problem is, that TYPO3 couldn't find a site for the given domain. Can you check if there is a correct site configuration?

cundd avatar Apr 02 '24 09:04 cundd

Hi,

I have a Site Management configuration. SiteManagement

and call to url http://localhost:8080/ opens a page with HELLO WORLD!.

You have further ideas?

Thank you in advance.

Lars114 avatar Apr 05 '24 14:04 Lars114

What happens if you open http://host.docker.internal:8080?

cundd avatar Apr 05 '24 18:04 cundd

Thank you for your answer. The problem was in the resolution of the url in the docker container. I have now configured the fixed url ' http://typo3.4allportal.com/`. The above error is fixed.

Instead, I get an error from multipart POST http://typo3.4allportal.com/rest/virtual_object-gallery/ with Authorisation header set. The error response is 403 Forbidden from

return $this->responseFactory->createErrorResponse('Forbidden', 403, $request);

Possible I have to set

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

to allow basic authentication? When yes in which file and where. I tried in /var/www/html/.htaccess but not worked.

Authentication with

POST http://typo3.4allportal.com/rest/auth/login HTTP/1.1
Host: typo3.4allportal.com
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

username=administrator&apikey=Crossmedia1!

responses with

{
  "status": "logged-in"
}

but I need basic authentication.

No error logged in typo3 http://typo3.4allportal.com/typo3/module/system/BelogLog

Thank you in advance.

Lars114 avatar Apr 12 '24 09:04 Lars114

You have to check if the sent data is present in one of the checked headers (see: https://github.com/cundd/rest/blob/v6/Classes/Authentication/BasicAuthenticationProvider.php#L35).

I can't tell how this has to be configured in your specific environment.

cundd avatar Apr 12 '24 19:04 cundd

I'm closing this issue since the original question seems to be answered

cundd avatar Apr 12 '24 19:04 cundd