I have a service running in the Google App Engine Standard Environment written in Go that is configured to use the latest runtime at deployment (api_version: go1 - which is currently Go 1.8).
In this service I inspect the request headers for various purposes.
func extractHeaders(res http.ResponseWriter, req *http.Request) {
ctx := appengine.NewContext(req)
clientIPAddress, _, _ := net.SplitHostPort(req.RemoteAddr) // Output is blank
country := req.Header.Get("X-AppEngine-Country") // Output: US
region := req.Header.Get("X-AppEngine-Region") // Output: ?
city := req.Header.Get("X-AppEngine-City") // Output: ?
cityLatLong := req.Header.Get("X-AppEngine-CityLatLong") // Output 0.000000,0.000000
...
}
As seen in the inline comment for the lines beginning where I read the RemoteAddr field, I am not getting the output I expected per the AppEngine Standard documentation found here (How Requests are Handled | App Engine standard environment for Go | Google Cloud Platform).
While the documentation states the that X-AppEngine-* may not always be able to be filled in based on the IP address of the client request, I am never seeing them filled in with data other than that which I listed.
Is there any configuration required to get these headers (and the RemoteAddr field) populated in the App Engine Standard Environment for Go? Am I simply misunderstanding the documentation?