Using an Apex callout to Google Maps geocoding API, I want to authorize narrowly within Google to protect the client ID from being reused by anyone else. I believe the referer header needs to match the authorization in Google for this to work. What's the referer header for the apex callout by default? salesforce.com? How could I check this? Can I use setHeader to change the referer to something more specific to us e.g. companyname . salesforce.com? Thanks!
This is an old question, but it is actually possible to use the setHeader() method to set the Referer. I had to make sure it was spelled 'Referer' (notice the capitals and the old-school misspelling) but it did work for me when attempting to grab a resource off an AWS server.
I'm posting this for anyone who, like me, was wondering if this is possible and found this question.