Skip to content
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

headers X-Forwarded-Host and X-Forwarded-Prefix not sent when proxying an API #1150

Closed
Yatufo opened this issue Apr 11, 2016 · 2 comments
Closed

Comments

@Yatufo
Copy link

Yatufo commented Apr 11, 2016

I have setup the latest docker https://github.com/Mashape/docker-kong/blob/0.7.0/Dockerfile

  1. Setup an API

curl -i -X POST
--url http://localhost:8001/apis/
--data 'name=myservice'
--data 'preserve_host=true'
--data 'strip_request_path=true'
--data 'upstream_url=http://myservice:6666'
--data 'request_path=/myapipath'

  1. Call a method in the API

curl -X POST 'localhost:8000/myapipath/account'
-H 'Content-Type: application/json'
-d '{"content": "content"}'

Expected result: all the headers should be sent and they should correspond with the POSTed values of the API.

Actual result:
Kong is not adding these two headers when forwarding to and api.
which causes this http://stackoverflow.com/questions/30584242/hateoas-paths-are-invalid-when-using-an-api-gateway-in-a-spring-boot-app issue.

Local solution:

I hard coded the values in the kong.yml based on https://getkong.org/docs/0.7.x/configuration/

proxy_set_header X-Forwarded-Host localhost:8000;
proxy_set_header X-Forwarded-Prefix /myapipath;

And then it works.

@mdan1eli
Copy link

Why not just use for the scenario a request transformer plugin to add headers?

subnetmarco added a commit that referenced this issue Apr 27, 2016
@subnetmarco
Copy link
Member

Will land in 0.8.1

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

3 participants