How to proxy forward to an internal service/app?

Hi everyone,

I have this kong service (a webapp) configured in my DB-less yaml file:

- name: my-web-service
  url: http://10.140.0.160:80
  routes:
  - name: web-oauth
    hosts:
      - web.example.com
    paths:
      - /oauth
    protocols:
      - https
  - name: web-route
    hosts:
    - web.example.com
    protocols:
    - https

All good, if I access my service, the webapp is working fine :slight_smile:
But when accessing web.example.com/oauth/ I want to proxy forward/redirect the request to an internal IP in my network (10.140.0.165:80)

In my older infrastructure I had this with Nginx like this:

location ~ ^/oauth {
  proxy_pass http://10.140.0.165:80;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-Proto $scheme;
}

How can I accomplish this in the Kong configuration file?


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ