Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Support for multi white listed urls with regex url match. #50

Merged
merged 1 commit into from
Jan 12, 2015

Conversation

vishnuchilamakuru
Copy link

Sample Command to run multi whitelisted urls with regex.

./google_auth_proxy
--redirect-url="http://yourcallbackurl.com/oauth2/callback"
--google-apps-domain="yourdomain.com"
--upstream=http://127.0.0.1:8080
--cookie-secret="nuts"
--client-id="your client id"
--client-secret="your client secret"
--cookie-expire=0h30m0s
--cookie-https-only=false
--skip-auth-regex="/hello.php","/status.php","/health-check-url/*"

@@ -299,6 +302,14 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
return
}

for _, u := range p.whiteListedUrls {
match, _ := regexp.MatchString(u, req.URL.Path)
if (req.URL.Path == u) || match {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this always perform a regex match so it's easier to reason about what's matched, and move the regex compilation outside of the request loop so we can give error feedback if invalid regex's are compiled sooner (ie: at startup).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified code to always perform regex match only. Also added error handling for regex match. Please have a look at updated branch.

@jehiah
Copy link
Member

jehiah commented Dec 24, 2014

Changes look great. Can you squash down to a single commit before i merge this?

@vishnuchilamakuru
Copy link
Author

Hi Jehiah,
Sqashed things to single commit.

jehiah added a commit that referenced this pull request Jan 12, 2015
Support for multi white listed urls with regex url match.
@jehiah jehiah merged commit 9d264f3 into bitly:master Jan 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants