Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/RequestOptions/RequestOptionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
'X-Algolia-API-Key' => $this->config->getApiKey(),
'User-Agent' => UserAgent::get(),
'Content-Type' => 'application/json',
// For Algolia API restriction, add referer.
// See: https://discourse.algolia.com/t/api-key-referrer-restrictions-do-not-work/6574/3
'referer' => $_SERVER['HTTP_HOST'],

Check failure on line 75 in src/RequestOptions/RequestOptionsFactory.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/RequestOptions/RequestOptionsFactory.php#L75

Detected usage of a possibly undefined superglobal array index: $_SERVER['HTTP_HOST']. Use isset() or empty() to check the index exists before using it

Check warning on line 75 in src/RequestOptions/RequestOptionsFactory.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/RequestOptions/RequestOptionsFactory.php#L75

Direct use of $_SERVER Superglobal detected.

Check warning on line 75 in src/RequestOptions/RequestOptionsFactory.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/RequestOptions/RequestOptionsFactory.php#L75

Direct use of $_SERVER Superglobal detected.
],
'query' => [],
'body' => [],
Expand Down