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

Base URL #4

Closed
kmlucy opened this issue Nov 19, 2018 · 11 comments
Closed

Base URL #4

kmlucy opened this issue Nov 19, 2018 · 11 comments

Comments

@kmlucy
Copy link

kmlucy commented Nov 19, 2018

Is there a way to set a base URL? I'd like to run Dozzle at /dozzle/, instead of at /.

@amir20
Copy link
Owner

amir20 commented Nov 19, 2018

@kmlucy This is not possible right now. But it wouldn't be too hard to add it. Before doing it, I want to make sure I understand your use case. I think in Docker you can only bound one container to each port. So I am wondering why it would be useful to have this running on /dozzle instead when it will have to be also another port anyway. Let me know if I am not understanding your use case.

@kmlucy
Copy link
Author

kmlucy commented Nov 19, 2018

I have it running behind a reverse proxy so I would like to be able to access it at https://URL/dozzle. The alternative is to create another subdomain. While that is possible, I would greatly prefer to just have it in a subdirectory instead.

@amir20
Copy link
Owner

amir20 commented Nov 19, 2018

If you are already running it behind a revery proxy then wouldn't it be possible to map /dozzle to locahost:8080/? Or is that not possible?

@kmlucy
Copy link
Author

kmlucy commented Nov 19, 2018

It is possible to map it, yes, but it doesn't work for any hardcoded paths. So when it tries to get something like /styles.css, it can't find it.

For this specific instance, the application doesn't load because it is looking for /main.4b8b43b8.js and /main.943eb0cf.css instead of /dozzle/main.4b8b43b8.js and /dozzle/main.943eb0cf.css.

@amir20
Copy link
Owner

amir20 commented Nov 19, 2018

ahhh. I see. Ok, that makes more sense. I thought that might be the problem but I wasn't sure. Let me see if I can make it easy to fix that.

@kmlucy
Copy link
Author

kmlucy commented Nov 19, 2018

Awesome, thanks!

@amir20 amir20 mentioned this issue Nov 19, 2018
@amir20
Copy link
Owner

amir20 commented Nov 19, 2018

@kmlucy can you try with https://github.com/amir20/dozzle/releases/tag/v1.2.0? It should work now with --base option which is documented in the readme file.

Please let me know how it goes! And thanks for the feedback.

@kmlucy
Copy link
Author

kmlucy commented Nov 19, 2018

That seems to have fixed this issue, but revealed another. I've opened #6, but this one look fixed. Thanks for the quick turnaround!

@kmlucy kmlucy closed this as completed Nov 19, 2018
@GTANAdam
Copy link

GTANAdam commented May 13, 2019

Ok, so how to pass the --base variable in docker-compose? why not just use environment variables?

UPDATE: Given the unusual use of arguments, I've managed to circumvent rebuilding the project to use environment variables (i.e: os.Getenv("ADDR")), I figured docker-compose could handle passing the arguments via command: https://docs.docker.com/compose/compose-file/#command

for example:

dockerlogs:
image: amir20/dozzle:latest
container_name: dockerlogs
restart: always
command: --base /dockerlogs
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro

@amir20
Copy link
Owner

amir20 commented May 13, 2019

I was going to suggest using command. The reason I hadn't done a lot in in ENV is because I have also released this project as binary. Which makes more sense than ENV.

It wouldn't be hard to make it read ENV though in https://github.com/amir20/dozzle/blob/master/main.go#L36-L38.

I use pflags so if there is an easy way to make that change, I'll happily accept PRs.

@amir20
Copy link
Owner

amir20 commented May 13, 2019

This might fix this.
#21

I'll need to update the docs. You can do DOZZLE_BASE=/test go run main.go

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

No branches or pull requests

3 participants