policy-bot
policy-bot copied to clipboard
Feature request: Please add support for X-Forward headers
I tried running policy-bot behind a reverse-proxy, working with github enterprise, and it appears that there's no support for X-Forwarded-* Headers. The app appears to only respect Host header.
$ curl -s -H "Forwarded: host=policybot.example.com" http://10.175.174.133:8080/api/github/auth
<a href="https://github.example.com/login/oauth/authorize?access_type=online&client_id=XXXX&redirect_uri=http%3A%2F%2F10.175.174.133%3A8080%2Fapi%2Fgithub%2Fauth&response_type=code&state=423c1f4ef94adcbdb9013edfdc988b14662d9b5a">Found</a>.
$ curl -s -H "X-Forwarded-Host: policybot.example.com" http://10.175.174.133:8080/api/github/auth
<a href="https://github.example.com/login/oauth/authorize?access_type=online&client_id=XXXX&redirect_uri=http%3A%2F%2F10.175.174.133%3A8080%2Fapi%2Fgithub%2Fauth&response_type=code&state=7a222f5786384f4ddc0699319018bb1b85de1af8">Found</a>.
$ curl -s -H "Host: policybot.example.com" http://10.175.174.133:8080/api/github/auth
<a href="https://github.example.com/login/oauth/authorize?access_type=online&client_id=XXXX&redirect_uri=http%3A%2F%2Fpolicybot.example.com%2Fapi%2Fgithub%2Fauth&response_type=code&state=995fd8bfee94f6bb816a12001701a6a0e78da5e9">Found</a>.
Expected result:
The redirect_uri= param should be set with the values sent in forward headers X-Forwarded-Host, and X-Forwarded-Prefix.