Vue - Ais-configure - aroundLatLngViaIP + 'X-Forwarded-For'


Following : Filter results around a location | Algolia

How can I add ‘X-Forwarded-For’ in the ais-configure option ?

searchParameters.value = {
  aroundLatLngViaIP: true,
  headers: {
  'X-Forwarded-For': ip


  • Vue 2
  • Vue Instant Search
  • ais-configure

Error : ApiError: Unknown parameter: headers at AlgoliaSearchHelper.eval



You should only have to pass this header on your backend, are you seeing an incorrect IP address?

However, to do this, you’ll need to pass a custom algoliasearch object to the ais-instantsearch widget to pass the headers option. There isn’t a request-time parameter to change the headers, only when you initially set up the class. I was able to find an example here:

You’ll want to then pass the headers object in the options after supplying your AppID and API Key:

data() {
  return {
    searchClient: algoliasearch(
        headers: { ... }

You can find more information on this in our documentation here: