AnsweredAssumed Answered

API Gateway and Hypermedia Links

Question asked by acalbazana on Mar 23, 2016
Latest reply on Mar 23, 2016 by Doyle_Reece

Hello,

 

I have a question about how to handle hypermedia links that are produced by backend services.  I have a handful of APIs that produce representation formats such as HAL.  Included in these response bodies are "links" to other REST resources.  The backend services produce these links have no knowledge of the API Gateway.  As a result, the URIs do not match up to what the Gateway wants as scheme, host, port, and resolution path.  For example:

 

Service is exposed as - https://my.apigateway.com/service/foo

 

URIs in response are produced as - https://my.backendservice.com/v1/service/foo

 

Obviously if a user clicks on the produced URI, it may not resolve on the Gateway.

 

So my question is, what is the best way to handle this?  I've seen backend services use X-Forwarded-* headers to fixup their URIs during response building.  This might get me host, port, and scheme, but this doesn't really help with incorporating the Gateway's resolution path.  I'd rather not re-write URIs if at all possible!  Has anyone dealt with this before?  

 

Thanks,

 

Alejandro

Outcomes