Flask-WTF CSRF validation fails when app moved to docker production environment

前端 未结 1 503
挽巷
挽巷 2021-01-24 10:39

I just set up my production environment for the Flask app I\'ve been developing.

This stack is:

Windows Server 2012 R2 
Hyper-V VM 
    - Running Ubuntu 14         


        
相关标签:
1条回答
  • 2021-01-24 10:55

    Basically I had this in my development config.py file:

    SERVER_NAME = 'localhost:5000'

    When I put the app on the production environment, I had to change it to:

    SERVER_NAME = '192.168.1.66'

    for the app to show up at all. But in the end I had to comment it out altogether. From my research it's only necessary when you're putting the app on a subdomain, which I am not.

    If anyone has any more insight into why this would cause CSRF token invalidation, I'd love to hear it.. I've been unable to track this down any further. So for now, I've removed it altogether.

    0 讨论(0)
提交回复
热议问题