Fix $referer parsing in \Drupal\cloud\Controller\CloudConfigLocationController::getCloudConfigLocation to use PHP's parse_url()

Created on 22 June 2023, over 1 year ago
Updated 23 June 2023, over 1 year ago

Problem/Motivation

  • Change $referer parsing in getCloudConfigLocation to use PHP's parse_url . There are scenarios where HTTPs is used, but terminated at the Load Balancer, while Drupal is running in an HTTP environment.
  • The current parsing code will result in a 500 error
        $referer = $this->request->headers->get('referer');
        // Get the alias or the referer.
        $alias = substr($referer, strlen($base_url));
        // Get the route name of the referer.
        $url = Url::fromUri('internal:' . $alias);
    
  • Change it to use parse_url() from PHP's library.
πŸ› Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States baldwinlouie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024