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

Multiple upstreams without subdomains #253

Open
DevSecNinja opened this issue May 22, 2016 · 3 comments
Open

Multiple upstreams without subdomains #253

DevSecNinja opened this issue May 22, 2016 · 3 comments

Comments

@DevSecNinja
Copy link

DevSecNinja commented May 22, 2016

Hello,

I have oauth2_proxy working with one upstream, which is great. I was wondering if it's possible to use multiple upstreams like http://server.com/app1 and http://server.com/app2 instead of using subdomains like http://app1.server.com and http://app2.server.com? All the issues and help files are using subdomains. I'm using Azure AD as a provider.

My Nginx config file would be something like this:

       location /app1 {
        proxy_pass http://127.0.0.1:4180;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 1;
        proxy_send_timeout 30;
        proxy_read_timeout 30;
        }

        location /app2 {
        proxy_pass http://127.0.0.1:4180;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 1;
        proxy_send_timeout 30;
        proxy_read_timeout 30;
        }

But as far as I know, I'm unable to redirect those locations to different hosts or ports in the oauth2_proxy config file, right?

Thank you.

@r3m0t
Copy link

r3m0t commented Nov 5, 2016

Why not run two instances of oauth2_proxy listening on different ports, with different settings?

@rmoriz
Copy link

rmoriz commented Jul 14, 2017

@r3m0t because then you will usually have to register n-applications with the provider because of the hard-coded callback domains (think of github).

@ploxiln
Copy link
Contributor

ploxiln commented Jul 14, 2017

The way to do this is to have the requests hit oauth2_proxy first, then be proxied to nginx, then from there nginx can proxy to any other applications with any transformation you need. Or, you can use nginx auth_request method.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants