Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable context-path #52

Open
Tedlar opened this issue Jan 9, 2020 · 8 comments
Open

Configurable context-path #52

Tedlar opened this issue Jan 9, 2020 · 8 comments
Assignees

Comments

@Tedlar
Copy link

Tedlar commented Jan 9, 2020

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
Copy link
Owner

hlavki commented Jan 9, 2020

@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.

@hlavki hlavki self-assigned this Jan 9, 2020
@Tedlar
Copy link
Author

Tedlar commented Jan 9, 2020

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
Copy link
Owner

hlavki commented Jan 9, 2020

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

@hlavki hlavki added the question label Jan 9, 2020
@Tedlar
Copy link
Author

Tedlar commented Jan 9, 2020

@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
Copy link
Owner

hlavki commented Jan 9, 2020

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

  • Why are you using 8183 port number when default port is 8181
  • What I read in nginx reverse proxy documentation, this should work:
location /auth/ {
    proxy_pass http://localhost:8181;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

@Tedlar
Copy link
Author

Tedlar commented Jan 9, 2020

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
Copy link
Author

Tedlar commented Jan 9, 2020

@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
Copy link
Owner

hlavki commented Jan 9, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants