nokia / kong-oidc

OIDC plugin for Kong
Apache License 2.0
454 stars 320 forks source link

Add http_proxy and https_proxy to params. #139

Open kaitoy opened 4 years ago

kaitoy commented 4 years ago

This enhance enables to pass http_proxy and https_proxy options to lua-resty-openidc and use a proxy for communication with OIDC provider.

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 145


Files with Coverage Reduction New Missed Lines %
./kong/plugins/oidc/utils.lua 1 98.55%
<!-- Total: 1 -->
Totals Coverage Status
Change from base Build 134: -0.6%
Covered Lines: 132
Relevant Lines: 138

💛 - Coveralls
fischerdr commented 4 years ago

Are the above diffs all that is needed to get oidc plugin to go through a application proxy?

kaitoy commented 4 years ago

Yes, we're using these changes in our production environment.

fischerdr commented 4 years ago

So an issue that I have is if the proxy requires auth. when I add username and password into the proxy line it messes up the call. for some reason it thinks the username is the short name of the host and fails url : http://:@proxy.example.com:8080 I was looking thru the source of the lua-resty-openidc and could not see where to add proxy auth variables

kaitoy commented 4 years ago

I think you can use http_proxy_authorization and https_proxy_authorization. (ref. https://github.com/ledgetech/lua-resty-http#set_proxy_options) I will try it.

fischerdr commented 4 years ago

Thanks! That worked. now i need to figure how to if/then the variables so it doesn't alway include them

kaitoy commented 4 years ago

I'm creating a commit to add http_proxy_authorization and https_proxy_authorization options.

kaitoy commented 4 years ago

I added the options for proxy auth and confirmed they work as expected.