hlavki / g-suite-identity-sync

G Suite to LDAP identity synchronizer
Apache License 2.0
128 stars 29 forks source link

Configurable context-path #52

Open Tedlar opened 4 years ago

Tedlar commented 4 years ago

I think it would be a great feature to add ability to configure web applications context-path (base path). Of course as variable passed to docker container. So you could change base url from: http://localhost:8181 to: http://localhost:8181/new-context

It would enable placing application behind reverse-proxy.

hlavki commented 4 years ago

@Tedlar, you don't need additional context path to configure application behind reverse-proxy. There is example docker-compose.yml with traefik v2 as reverse proxy. No problem to configure using apache or nginx.

Tedlar commented 4 years ago

Still I have configuration problem. On host machine I have already few applications. Those applications are standing behind revers proxy (nginx) so I can access all of them through standard http(s) ports. So http://my.server.com/app1 -> http://my.server.com:8000 I would like to have same configuration for your syncing app.

hlavki commented 4 years ago

@Tedlar, could you show me your reverse proxy configuration?

Tedlar commented 4 years ago

@hlavki no problem.

        location /auth {
                rewrite ^auth(.*) /$1 break;
                proxy_pass http://localhost:8183;
                proxy_set_header Host $host:$server_port;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
hlavki commented 4 years ago

@Tedlar I am not NGINX expert, but couple of thoughts:

Tedlar commented 4 years ago

Nope, not working. All css and js files are being fetched using wrong path (without '/auth'). I also added configuration:

location / {
  if ($http_referer ~ "^https?://[^/]+/auth"){
    rewrite ^/(.*) http://$http_host/auth/$1 redirect;
  }
}

Thanks to that application is being loaded properly. Still 'Redirect url' is messed up. Damn.

Tedlar commented 4 years ago

@hlavki For now i moved your app to base url ('/') and everything works. I hope that in near future I will be able to move it to proper path ('/auth/')

hlavki commented 4 years ago

yes, I understand your problem. I will let you know if I found some solution.