我有一個帶有令牌身份驗證的 Django 應用程式,我通過 Apache2 為它提供服務。當我使用域名向服務器執行身份驗證所需的請求時,它回傳 401 Unauthorized HTTP 錯誤。當我使用 ip:port 執行此操作時,它會回傳成功。相同的令牌被發送到服務器。什么可能導致這種情況?apache服務器可能與此有關嗎?
這是我的 apache 配置:
<VirtualHost *:80>
ServerAdmin ...
ServerName semanticspace.io
ServerAlias www.semanticspace.io
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/cuneyttyler/knowledgebase/knowledge-base-django/static
<Directory /home/cuneyttyler/knowledgebase/knowledge-base-django/static>
Require all granted
</Directory>
Alias /media /home/cuneyttyler/knowledgebase/knowledge-base-django/media
<Directory /home/cuneyttlyer/knowledgebase/knowledge-base-django/media>
Require all granted
</Directory>
<Directory /home/cuneyttyler/knowledgebase/knowledge-base-django/knowledgebase_python>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess knowledge-base-django python-path=/home/cuneyttyler/knowledgebase/knowledge-base-django python-home=/home/cuneyttyler/knowledgebase/knowledge-bas>
WSGIProcessGroup knowledge-base-django
WSGIScriptAlias / /home/cuneyttyler/knowledgebase/knowledge-base-django/knowledgebase_python/wsgi.py
</VirtualHost>
uj5u.com熱心網友回復:
Apache 默認不傳遞Authorization標頭,您需要將以下內容添加到您的 VirtualHost 配置并重新啟動 Apache
WSGIPassAuthorization On
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/491112.html
上一篇:ReferenceError:Vue未定義|vuejs3、jest、@testing-library/vue和jest-environment-jsdom
