【发布时间】:2016-05-08 19:03:51
【问题描述】:
我正在尝试使用 JWT 身份验证,但无法读取 authtoken。 如果我沿着 url 发送令牌,它可以正常工作,但在标题中它不会。 这个链接说如果在 Apache 上,我们需要配置 apache 配置。我也这样做了,但它不起作用。 https://github.com/tymondesigns/jwt-auth/wiki/Authentication
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
我尝试在 public/ 内部的 Laravel 5.2 中更改 .htacess
我当前的 .htaccess 看起来像这样
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</IfModule>
我错过了什么或做错了吗?
【问题讨论】:
标签: php apache .htaccess laravel-5.2