Kong: proxy_redirect configuration is needed in admin api

Created on 1 Jun 2018  Â·  2Comments  Â·  Source: Kong/kong

We are using kong as a automatic load balance proxy. We were trying using admin API https://getkong.org/docs/0.13.x/loadbalancing/ https://getkong.org/docs/0.13.x/admin-api/ to configure kong to server web application backend (like tomcat and java application).

But now we are facing a problem , that can be fix by nginx http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect , but we can't find a same parameter to configure kong.

Is that feature needed in kong?

Most helpful comment

By Reading https://github.com/Kong/kong/issues/839 ,Knowledge that I can configure nginx to fix this bug,read this to change nginx configuration:
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect
By reading https://getkong.org/docs/0.13.x/configuration/#custom-nginx-configuration knowledeg that I can chage kong-nginx.conf。
by find /|grep nignx, I find this /usr/local/kong/nginx-kong.conf confirguration file,and then I find this file was generated by /usr/local/share/lua/5.1/kong/templates/nginx_kong.lua 。
Finally I change this file /usr/local/share/lua/5.1/kong/templates/nginx_kong.lua ,at the server listening 8000 port , at the location / append this proxy_redirect ~^(http://[^:]+):\d+(/.+)$ $2;
Restart kong, it works。
I tested the redirect 302 like this
Location: http://127.0.0.1:8000/iPlatAPM/login.jsp
before:
Location: http://10.70.xx.xx:8090/iPlatAPM/login.jsp
The probelm fixed。

All 2 comments

I'm about to try https://github.com/Kong/kong/issues/839 to change nginx configuration

By Reading https://github.com/Kong/kong/issues/839 ,Knowledge that I can configure nginx to fix this bug,read this to change nginx configuration:
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect
By reading https://getkong.org/docs/0.13.x/configuration/#custom-nginx-configuration knowledeg that I can chage kong-nginx.conf。
by find /|grep nignx, I find this /usr/local/kong/nginx-kong.conf confirguration file,and then I find this file was generated by /usr/local/share/lua/5.1/kong/templates/nginx_kong.lua 。
Finally I change this file /usr/local/share/lua/5.1/kong/templates/nginx_kong.lua ,at the server listening 8000 port , at the location / append this proxy_redirect ~^(http://[^:]+):\d+(/.+)$ $2;
Restart kong, it works。
I tested the redirect 302 like this
Location: http://127.0.0.1:8000/iPlatAPM/login.jsp
before:
Location: http://10.70.xx.xx:8090/iPlatAPM/login.jsp
The probelm fixed。

Was this page helpful?
0 / 5 - 0 ratings