Closed Nagriar closed 9 years ago
All headers are passed via query string to avoid OPTION requests (for searches).
We could force headers passed to setExtraHeader to be passed via real headers but I wonder if this would break some of our website code @redox ? Or trigger option request on the dashboard (wich may be already the case or may be acceptable)
Or we could add an extra option to force real header but it sounds weird.
This was a Node.js requirement and in Node.js everything is passed with http headers (not query string).
Also for future references, in the browser setting this header (or any custom header) would trigger an OPTION request.
See http://www.html5rocks.com/en/tutorials/cors/#toc-types-of-cors-requests
hi people,
I am trying to add headers: {'X-Forwarded-For': ip.toString() },
, in order to get the total users as total metric in algolia. however i dont see any changes in total users in the dashboard.
I put a logs..and i got the : ip: 10.101.53.4
, so i am receiving the ip as well.
this is the block code :
const products = await index.search<AlgoliaOutputDocument>('', {
headers: {'X-Forwarded-For': ip.toString() },
filters: filtersString,
distinct: false,
hitsPerPage: 1000,
numericFilters: numericFilters.length ? numericFilters : undefined,
attributesToHighlight: [],
attributesToRetrieve: ['*', '-sku.slug', '-sku.description', '-sku.created_at']
});
thank you for your help.
When you set header X-Forwarded-For with the method setExtraHeader, the header is passed via the query string parameters. It should go directly via the headers.