I have two services running on the Google App Engine (MS1 & MS2). MS1 is deployed in the Standard Environment and MS2 is deployed in the Flexible Environment. I am invoking an API from Standard Environment to the Flexible Environment. I want to make sure that MS2 only accepts requests originating from MS1. So, I decided to use this feature from App Engine. I am setting the X-Appengine-Inbound-Appid
header and setInstanceFollowRedirects
to false
in MS1, but looks like App Engine is removing this header. I am not able to find this header in MS2.
HttpHeaders headers = new HttpHeaders();
headers.add("X-Appengine-Inbound-Appid", ApiProxy.getCurrentEnvironment().getAppId());
HttpEntity<MergePdfsResource> entity = new HttpEntity<MergePdfsResource>(mergePdfsResource, headers);
restTemplate.setRequestFactory(new SimpleClientHttpRequestFactory() {
protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
super.prepareConnection(connection, httpMethod);
connection.setInstanceFollowRedirects(false);
}
});
ResponseEntity<SomeClass> response = restTemplate.postForEntity(apiUrl, entity, SomeClass.class);