Skip to content

Commit

Permalink
Don't use basic auth for CSS/JS loading; should be in host.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Sep 28, 2023
1 parent 0833df8 commit a53937b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions modules/quant_api/src/EventSubscriber/QuantApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,13 @@ public function onOutput(QuantEvent $event) {
$local_server = $config->get('local_server') ?: 'http://localhost';
$url = $local_server . $item['original_path'];

// Set headers.
// Set the headers.
$headers['Host'] = $config->get('host_domain') ?: $_SERVER['SERVER_NAME'];

// Handle basic authentication. Note, this will not work via Drush/CLI.
$auth = !empty($_SERVER['PHP_AUTH_USER']) ? [
$_SERVER['PHP_AUTH_USER'],
$_SERVER['PHP_AUTH_PW'],
] : [];

// If using basic auth, the credentials must already be in the host.
$response = \Drupal::httpClient()->get($url, [
'http_errors' => FALSE,
'headers' => $headers,
'auth' => $auth,
'allow_redirects' => FALSE,
'verify' => boolval($config->get('ssl_cert_verify')),
]);
Expand Down

0 comments on commit a53937b

Please sign in to comment.