question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consumer base_uri field filled with API gateway host if needed

See original GitHub issue

When a new consumer is created, the base_uri returned in the HTTP body by the bridge contains the address to be used by the client for subsequent consumer operations. The bridge uses the HTTP “Host” header for getting the address that the HTTP client has to call. Using an API gateway (i.e. 3scale) in front of the bridge changes the scenario. The HTTP client is using the API gateway address and it should be used in the future requests but because the bridge isn’t aware that the request comes from an API gateway, just use the “Host” header and … the client gets the bridge address instead of the API gateway one in the base_uri field.

For example, client sends request to:

http://gateway.192.168.1.9.nip.io:8080/consumers/my-group

but the base_uri in the JSON response is:

http://bridge.192.168.1.9.nip.io:8083/consumers/my-group/instances/consumer1

On solution could be having the API gateway adding a custom header in each request like API_GATEWAY_HOST so that the bridge can use this one instead of the default “Host” as base address in the base_uri.

@tombentley @scholzj @kyguy @stanlyDoge any thoughts?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ppatiernocommented, Jun 28, 2019

The issue was fixed by the 3scale team now it’s possible to create a header policy at 3scale configuration level to add the three X-Forwarded headers so that the bridge can use them for building the base_uri field or if not present continue to use Host as today.

0reactions
ppatiernocommented, Jun 28, 2019

So using 3scale I was able to use a header policy to add X-Forwarded-Host getting the Nginx $host variable exposed via Liquid. Currently, there is no way of getting the scheme and the port. I had a call with @eloycoto from 3scale team and he opened an issue for adding more information.

https://github.com/3scale/APIcast/issues/1079

At the end, I will be able to use X-Forwarded-Host, X-Forwarded-Proto and X-Forwarded-Port even if the last one is completely custom because doesn’t exist, in the Mozilla documentation neither. While Eloy works on having them available I can change the bridge accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set up a method request in API Gateway - AWS Documentation
In an API Gateway API, you expose addressable resources as a tree of API Resources entities, with the root resource ( / )...
Read more >
Implementing an API Gateway in ASP.NET Core with Ocelot
An API Gateway decouples the service producer from its consumer, providing a security layer since you need not expose your microservices ...
Read more >
An Introduction to Kong - Baeldung
Kong is an open-source API gateway and microservice management layer. ... The consumer's name (or id) is the only required field of all ......
Read more >
Web API implementation - Best practices for cloud applications
When you implement and deploy a web API, you should consider the physical requirements of the environment hosting the web API and the...
Read more >
webMethods API Gateway User's Guide
This document applies to webMethods API Gateway 10.7 and to all ... will need to register and specify "Documentation" as an area of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found