Question

Is it possibile to allow requests to a gae endpoint method only from a specific domain (e.g. www.myname.com) and refuse everything else?

I'm looking for something like an app authentication (I don't want a user login)

many thanks

Was it helpful?

Solution

You could try out the following approach:

Inject the HTTPServletRequest parameter into your APIMethod.

@ApiMethod(path = "resources/{id}")

public Resource get(@Named("id") int id, HttpServletRequest request) {

//Use the request parameter here...

}

From the request parameter above, use the following:

String host = request.getRemoteHost(); 

Keep in mind that the host value can be your client or proxy's host name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top