1

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!

0

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.

1
  • Thanks @4k4 for your answer but it doesn't work, \Drupal\Core\Url::fromRoute('<front>')->setAbsolute()->toString() i have tested this before it gives the right protocol, and also i have added reverse_proxy settings but not working either, all redirection in the site works with the https correctly, i will update my question accordingly !
    – berramou
    Sep 30 '20 at 16:00
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.