[Solved]-Django JWT Authentication behavior different between local & mod_wsgi servers with Django REST framework

16๐Ÿ‘

โœ…

I have encountered similar problem. I figure out that I was missing below directive in the Apache configuration file

WSGIPassAuthorization On
๐Ÿ‘คLukasz Dynowski

1๐Ÿ‘

The solution is in apache conf file, we need to turn on WSGIPassAuthorization like this:

<VirtualHost *:80>
ServerAlias example.com
ServerName example.com
Alias /static /srv/www/MyProject/MyProject/static
<Directory /srv/www/MyProject/MyProject/static>
    Require all granted
</Directory>
<Directory /srv/www/MyProject/MyProject/>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>
WSGIDaemonProcess example python-path=/srv/www/MyProject/MyProject python-home=/srv/envs/venv
WSGIProcessGroup example
WSGIScriptAlias / /srv/www/MyProject/MyProject/wsgi.py
WSGIPassAuthorization On
</VirtualHost>
๐Ÿ‘คShahid Tariq

-1๐Ÿ‘

.
.
.
.

WSGIPassAuthorization On
<Directory /webapps/django>
    Order allow,deny
    Allow from all
</Directory>

.
.
.
.

This work for me Thank you very much
https://gulshan1996.blogspot.com/2021/04/jwt-auth-is-not-working-on-apache-server.html

Leave a comment