FlaskBB
A lightweight forum software in Flask
Member
Joined:
Posts: 96

Hi everyone,

I've installed flaskbb software as shown in documentation and everything forks fine when I run development server ( flaskbb run )
I deployed the flaskbb under nginx / uwsgi, it runs but every time I try to send any form ( login, for example ) I get the error "The CSRF session token is missing."
I tried to use WTF_CSRF_ENABLED = False option but in this case login doesn't work at all. Maybe you have any idea how to resolve the problem?
I'd appreciate any help cause I have no idea. My configuration files:

uwsgi

[uwsgi]
chdir=/path/to/flaskbb/
venv=/path/to/flaskbb/.venv/
socket=127.0.0.1:9003
mount=/flaskbb=wsgi.py
callable=flaskbb
plugin=python
manage-script-name=true

nginx

server {
        listen 80 default_server;
        root /path/to/myapp_dir;

        error_log /var/log/nginx/error.forums.log;

        location / {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:9001;
        }

        location /flaskbb/ {
            try_files $uri @flaskbb;
        }

        location /flaskbb/static/ {
            alias /path/to/flaskbb/flaskbb/static/;
        }

        location ~ ^/_themes/([^/]+)/(.*)$ {
            alias /path/to/flaskbb/flaskbb/themes/$1/static/$2;
        }

        location @flaskbb {
            include uwsgi_params;
            uwsgi_param SCRIPT_NAME /flaskbb;
            uwsgi_pass 127.0.0.1:9003;
        }

        location /static/ {
            if (-f $request_filename) {
                rewrite ^/static/(.*)$ /static/$1 break;
            }
        }
    }
Member
Joined:
Posts: 96

Seems I've found a solution
just add the following string to flaskbb.cfg:

SESSION_COOKIE_DOMAIN = "your_server_address"

maybe it helps someone

Administrator
avatar
Joined:
Posts: 139

demo wrote:

Seems I've found a solution
just add the following string to flaskbb.cfg:

SESSION_COOKIE_DOMAIN = "your_server_address"

maybe it helps someone

Thanks for posting a solution. Sorry for my late reply -- I haven't had much time last week(end).


Cheers! 🍻