How to setup Https on Vikunja Frontend Docker #45

Closed
opened 2025-11-01 20:45:20 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @AmoghSaxena on GitHub (Apr 16, 2022).

I have nginx Installed in my server and also Vikunja installed as docker container. I dont know to setup it as Https.

If i use Frontend in HTTP. Its working fine and all my setting are going great but When i try to shift it to HTTPS using nginx it Doesnt work properly.

Here is my Nginx Conf

server {
  server_name planner.realmx.space;

  access_log /var/log/nginx/planner.realmx.space.access;
  error_log /var/log/nginx/planner.realmx.space.error;

  location / {
    proxy_pass              http://localhost:8890/;
    proxy_set_header        X-Forwarded-Host        $server_name:$server_port;
    proxy_hide_header       Referer;
    proxy_hide_header       Origin;
    proxy_set_header        Referer                 '';
    proxy_set_header        Origin                  '';
    add_header              X-Frame-Options         "SAMEORIGIN";
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/realmx.space/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/realmx.space/privkey.pem; # managed by Certbot
    #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    #ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot


    ssl_trusted_certificate /etc/letsencrypt/live/realmx.space//chain.pem; # managed by Certbot
    ssl_stapling on; # managed by Certbot
    ssl_stapling_verify on; # managed by Certbot

}
server {
    if ($host = planner.realmx.space) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


  listen 80;
  server_name planner.realmx.space;

  access_log /var/log/nginx/planner.realmx.space.access;
  error_log /var/log/nginx/planner.realmx.space.error;

  location / {
    proxy_pass              http://localhost:8890/;
    proxy_set_header        X-Forwarded-Host        $server_name:$server_port;
    proxy_hide_header       Referer;
    proxy_hide_header       Origin;
    proxy_set_header        Referer                 '';
    proxy_set_header        Origin                  '';
    add_header              X-Frame-Options         "SAMEORIGIN";
  }




}
Originally created by @AmoghSaxena on GitHub (Apr 16, 2022). I have nginx Installed in my server and also Vikunja installed as docker container. I dont know to setup it as Https. If i use Frontend in HTTP. Its working fine and all my setting are going great but When i try to shift it to HTTPS using nginx it Doesnt work properly. Here is my Nginx Conf ``` server { server_name planner.realmx.space; access_log /var/log/nginx/planner.realmx.space.access; error_log /var/log/nginx/planner.realmx.space.error; location / { proxy_pass http://localhost:8890/; proxy_set_header X-Forwarded-Host $server_name:$server_port; proxy_hide_header Referer; proxy_hide_header Origin; proxy_set_header Referer ''; proxy_set_header Origin ''; add_header X-Frame-Options "SAMEORIGIN"; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/realmx.space/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/realmx.space/privkey.pem; # managed by Certbot #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot #ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot ssl_trusted_certificate /etc/letsencrypt/live/realmx.space//chain.pem; # managed by Certbot ssl_stapling on; # managed by Certbot ssl_stapling_verify on; # managed by Certbot } server { if ($host = planner.realmx.space) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name planner.realmx.space; access_log /var/log/nginx/planner.realmx.space.access; error_log /var/log/nginx/planner.realmx.space.error; location / { proxy_pass http://localhost:8890/; proxy_set_header X-Forwarded-Host $server_name:$server_port; proxy_hide_header Referer; proxy_hide_header Origin; proxy_set_header Referer ''; proxy_set_header Origin ''; add_header X-Frame-Options "SAMEORIGIN"; } } ```
Author
Owner

@kolaente commented on GitHub (Apr 18, 2022):

What exactly does not work? What error message do you get?

@kolaente commented on GitHub (Apr 18, 2022): What exactly does not work? What error message do you get?
Author
Owner

@AmoghSaxena commented on GitHub (Apr 19, 2022):

What exactly does not work? What error message do you get?

No error message. UI loads in some sort of weird way. My Registration is off but UI loads with registration button enabled also you wont be able to login on that UI even tho we have option for login.

@AmoghSaxena commented on GitHub (Apr 19, 2022): > What exactly does not work? What error message do you get? No error message. UI loads in some sort of weird way. My Registration is off but UI loads with registration button enabled also you wont be able to login on that UI even tho we have option for login.
Author
Owner

@kolaente commented on GitHub (Apr 20, 2022):

Can you reach the api at https://planner.realmx.space/api/v1/info?

@kolaente commented on GitHub (Apr 20, 2022): Can you reach the api at `https://planner.realmx.space/api/v1/info`?
Author
Owner

@AmoghSaxena commented on GitHub (Apr 21, 2022):

Can you reach the api at https://planner.realmx.space/api/v1/info?

If i hit API with HTTP then YES we are able to hit able API. But if I turn my Frontend to HTTPS then I am not able to API

Wait let me explain with screenshot

  • Frontend with HTTP

image

  • Frontend with HTTPS

image

@AmoghSaxena commented on GitHub (Apr 21, 2022): > Can you reach the api at `https://planner.realmx.space/api/v1/info`? ### If i hit API with HTTP then YES we are able to hit able API. But if I turn my Frontend to HTTPS then I am not able to API #### Wait let me explain with screenshot #### * #### Frontend with HTTP ![image](https://user-images.githubusercontent.com/13078900/164445122-d0d8cf91-4ed3-4d07-a94c-2858a754a29b.png) * #### Frontend with HTTPS ![image](https://user-images.githubusercontent.com/13078900/164444770-74c3da94-7c48-4fcc-a2d0-7dc473a883cf.png)
Author
Owner

@kolaente commented on GitHub (Apr 21, 2022):

It looks like you do not proxy the api requests to the api container. Please take a look at the nginx example here: https://vikunja.io/docs/reverse-proxy/#without-gzip

You'll likely need to include the second location block in your nginx config.

Since you're already hosting with docker, I'd recommend you getting familiar with caddy, traefik or another reverse proxy. They make the one thing you're trying to achieve a lot easier.

@kolaente commented on GitHub (Apr 21, 2022): It looks like you do not proxy the api requests to the api container. Please take a look at the nginx example here: https://vikunja.io/docs/reverse-proxy/#without-gzip You'll likely need to include the second location block in your nginx config. Since you're already hosting with docker, I'd recommend you getting familiar with caddy, traefik or another reverse proxy. They make the one thing you're trying to achieve a lot easier.
Author
Owner

@dpschen commented on GitHub (Oct 4, 2022):

@AmoghSaxena Could you figure it out?

@dpschen commented on GitHub (Oct 4, 2022): @AmoghSaxena Could you figure it out?
Author
Owner

@AmoghSaxena commented on GitHub (Oct 14, 2022):

@AmoghSaxena Could you figure it out?

@dpschen Yes. Apply port forwarding if you are deploying it in a container.

If you need configurations, let me know, I'll share it.

@AmoghSaxena commented on GitHub (Oct 14, 2022): > @AmoghSaxena Could you figure it out? @dpschen Yes. Apply port forwarding if you are deploying it in a container. If you need configurations, let me know, I'll share it.
Author
Owner

@kolaente commented on GitHub (Oct 22, 2022):

Closing as resolved, please ping if you have other issues.

@kolaente commented on GitHub (Oct 22, 2022): Closing as resolved, please ping if you have other issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#45