Frontend files not communicating. #1723
Labels
No Label
dependencies
duplicate
help wanted
invalid
kind/bug
kind/feature
needs reproduction
question
security
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/vikunja#1723
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I am very excited to try Vikunja out. I have nabbed your docker images, and despite my best efforts, have not been able to get the frontend to make an API call to the back end.
Here's the situation. I have a traefik reverse proxy, using traefik 2. I am listening with traefik on ports 80 and 443, and there is a rule for host(
vikunja.example.com
) which routes HTTP(80) to HTTPS(443) and uses an LE certificate to provide TLS. I am able to connect the the frontend.I can also see the backend api just fine.
curl -s http://vikunja.EXAMPLE.com:3456/api/v1/info
{"version":"0.12+73-f30e405229","frontend_url":"https://vikunja.EXAMPLE.com","motd":"","link_sharing_enabled":true,"max_file_size":"20MB","registration_enabled":true,"available_migrators":null,"task_attachments_enabled":true}
You have some recent commits, so I grabbed the master.zip files and volume mounted them as /usr/share/nginx/html. Still no dice. I have enabled some debug logging, and I can see logs from me hitting the frontend, but nothing shows in the api's logs as far as connections go. My curl commands against the api do show up in the logs.
Finally, I exec'd a shell onto the frontend container, and attempted to curl again against the api, which completed successfully, showing that the container can reach the api and the url for the api is working.
What I get is a login page, no credentials work, or even seem to process (nothing on the api backend). I can click reset, and still no dice. I've tried running the frontend files on just a local nginx proxy and still nothing. Any suggestions?
The docker container always has the latest release version, no need to mount the files.
Did you set the api url in the frontend?
@OldManNiko I had similar issues, but got it working eventually. Without comparing config I think the main difference is that I'm not attempting to redirect 80 to 443 anymore. Both API and Frontend are only available over https.
Maybe that's the issue: The browser does the connection to the api, not the frontend api container. The frontend is run completely in the browser. Therefore the browser needs to be able to access the api.
@konrad Yes, I did try setting the enviroment variable in the docker service itself:
enviroment:
VIKUNJA_API_URL: http://vikunja.EXAMPLE.com:3456/api/v1
When that failed to produce the expected results I then started moving the config files into volume mounts and editing them locally. I tried modifying the nginx.conf on the frontend, statically set the URL in the index.html all to no avail.
Thinking the issue might be traefik related (at least the networks associated with the proxy). I moved the containers to a bridge of the host. Still no dice, even though I could curl the url's (frontend and 3456:/api/v1) from each of the containers.
I then took @adrinux 's advice and placed the frontend on http with no https redirect. Once I did this, I am able to start the app, add a user and begin to use it.
I have a pretty monolithic docker-compose I use to get my homelab orechstrated. I am happy to share the relevant parts if you like. It looks like a bit of work with the reverse proxy and the frontend needs to be done to get this going on my configuration of Traefik 2. I am happy to help with any tests, or solutions you want to run by me.
I might be an idea to make the api available on the same host as the frontend under the
/api/v1
sub path. That way, the frontend does not need any configuration.Can you show the relevant part of the
docker-compose.yml
?(I know the config examples in the docs are only traefik 1, I plan on updating that soon)
You should only need to provide the
entrypoints
andrule
parameters.Traefik should recognize Vikunja's port and proxy requests to
/api/v1
to it automatically. IIRC you should not need anything else.The
ports
option you configured is actually counterproductive: That will make the api container available on port3456
on the host while completely bypassing traefik.Here's my setup for comparison - this gets included into my docker-compose file by Ansible so there are some jinja2 vars in there but you should be able to translate it.
(EDIT: I generate wildcard Letsencrypt certs on the host and include them via my traefik dynamic conf so all that's needed here is the enable tls label)
Meanwhile, I've added an example config for traefik 2 to the docs.
Thanks so much! I am closing this ticket as it is now resolved. You have been a great help. Final config:
Glad I could help.