It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

XSRF check failed with nginx and ssl Edited



  • bitbucket server and nginx are on the same host.
  • Linux debian 9 (stretch)
  • nginx from official debian source
  • Atlassian Bitbucket v5.10.0
  • Physical host (not a VPS)

I have several problems setting up a bitbucket server with nginx and ssl.
I want to clarify that when I access the website from http://myhost:7990/ none of the following issues occur.

Several pages triggers "XSRF check failed" (adding user in a group, list of commits of a repo for example) when I look at the network tab of my firefox development tool, I have errors 403 with this response.

My nginx virtualhost settings:

server {
        location / {
                include proxy_params;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Server $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_redirect off;

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

server {
        if ($host = {
                return 301 https://$host$request_uri;
        } # managed by Certbot

        listen 80;
        return 404; # managed by Certbot

 My shared/



 And is configured in my url settings on the website.

I would just like to know how to solve this problem, except otherwise, the rest works pretty well :).

2 answers

1 accepted

0 votes
Answer accepted

After hours of trying several times on the nginx conf, I rebooted the server and made a reset cache (ctrl + f5 on firefox) and now everything works. I have no explanation, but the config posted above is still the same, if it helps someone.

Sorry for the inconvenience...

Have a nice day !

0 votes



Could you provide info from  ?

include proxy_params;



Gonchik Tsymzhitov


I use it for most of my django processes.

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

 I tried to remove it, but when I do it and I make a save (for example in the server settings) I am always redirected to or, it's problematic being given that bitbucket server is hosted on a dedicated


edit: I tried to disable the clones but it changes nothing, when "proxy_set_header Host $http_host;" is not define, I'm redirected to when I save on bitbucket settings.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Share your software development horror stories!

Hey Community! I work on the Bitbucket product marketing team. With Halloween approaching, we wanted to discuss a topic tailor-made for October: development horror stories. Whether it was a lurk...

1,003 views 11 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you