Skip to content

server.js context parameter #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mattiaerre opened this issue Aug 27, 2017 · 1 comment
Open

server.js context parameter #4

mattiaerre opened this issue Aug 27, 2017 · 1 comment
Assignees

Comments

@mattiaerre
Copy link
Member

Description

is context the request parameter in an Express.js application? I've got the feeling that this plugin always returns the same IP address and I wonder if there is either some cache at the plugin level or the IP that is shown is the one of the Registry.

If you want to have a look at the discrepancy you can check the source of this page:

https://supersonic-lobster.herokuapp.com/

screen shot 2017-08-26 at 8 40 13 pm

the 1st box contains the IP address of the request, the 2nd one of the context.

// cc @matteofigus

@mattiaerre mattiaerre self-assigned this Aug 27, 2017
@matteofigus
Copy link
Member

matteofigus commented Aug 30, 2017

The context.requestHeaders object comes from
the registry's express req.headers object: https://github.com/opentable/oc/blob/cc22411efb2e0b4ed5d19e82fa65248fd6e60c59/src/registry/routes/component.js#L13

So this means that what you see there should be the header that was sent to the registry either by the browser or the oc node client. If you are using the node client, you need to ensure you are forwarding this header.

In theory, you should be able to test this by curling the OC component endpoint and setting arbitrary headers as part of the req. What do you see if you do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants