Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    But doesn't this give me the host of the api?It might be caused by the fact that i'm doing this locally and i have api.time.ly set to resolve to 127.0.0.1 and the call i'm making is from localhost ,but if i use that, host is "api.time.ly" i need to know the domain which is calling me. i will test this on a live site. Commented Aug 28, 2013 at 21:54
  • 1
    @NicolaPeluchetti I guess I don't understand what you mean by "the domain which is calling me." HTTP clients don't typically supply their own hostname in the request. Is this for CORS? Commented Aug 28, 2013 at 22:07
  • I've got a central api which is located at api.time.ly. This api is called by different client websites which install our wordpress plugin. So we could have church1.com and sauna1.com make calls to our api. In the API would i be able to get if the call was made from church1.com or from sauna1.com? i saw a header 'user-agent': 'WordPress/3.6; http://localhost/wordpress_clean' should i parse that? Commented Aug 28, 2013 at 22:31
  • If Domain is not passed, it's not a problem, i can add it to the API call obviously. Commented Aug 28, 2013 at 22:38
  • @NicolaPeluchetti You can try splitting and parsing the user-agent or requiring it as data in the request. But, I'd say something like OAuth would be better suited for identifying clients. Commented Aug 28, 2013 at 22:45