Question

i'm working on a project and all batch callbacks in http not https so instead of redirecting to https://example.com/batch?id=844&op=start redirect to http://example.com/batch?id=844&op=start, and as result query params get lost and redirect me after to https://example.com/batch which gives me a 403 forbidden page: enter image description here

i have checked htaccess file and also the server i don't have any redirection.
anyone has experienced this, any help ?

EDIT:
I have checked the result of \Drupal\Core\Url::fromRoute('<front>')->setAbsolute()->toString() i get the url correct with the right protocol and also i have added:

$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);

to my settings.php and again no luck.
Note: all redirections in the site works perfectly with https only this one!

Was it helpful?

Solution 2

The issue was caused by the apache server, the HTTPS variable wasn't set to on so the Drupal in redirection send Location: response header with HTTP instead of HTTPS.
So the solution is to set HTTPS variable to on with:

  SetEnv HTTPS on

OTHER TIPS

For debugging try to output the result of:

\Drupal\Core\Url::fromRoute('<front>')->setAbsolute()->toString()

Is this the wrong protocol, too? Then your browser terminates with a different protocol than the CDN to your web server.

Symfony is able to detect the correct protocol, but you need to configure the CDN (reverse proxy) in settings.php.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top