After debugging I found what was the problem for me.
Drupal has some authentication providers. For standard pages this are:
basic_auth and cookie (basic_auth has higher priority).
Because test site has a basic_auth from the htaccess, this resulted in that Drupal marked my request as using basic_auth.
Only all pages did not require this.
Result was just redirect to the 403 page (access denied in the watchdog table)
My temporary fix was the following:
Open the file core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php
Go to this code:
public function applies(Request $request) {
$username = $request->headers->get('PHP_AUTH_USER');
$password = $request->headers->get('PHP_AUTH_PW');
return isset($username) && isset($password);
}
Change it to this:
public function applies(Request $request) {
return false;
//$username = $request->headers->get('PHP_AUTH_USER');
//$password = $request->headers->get('PHP_AUTH_PW');
//return isset($username) && isset($password);
}
If there is a better solution, let me know. But this makes the site working.