目前,我已经成功地设置了我的Laravel Passport API
使用Laravel 5.8。
我的api有这个httpd-vhosts.conf配置
港口: 80
<VirtualHost *:80>
ServerName <sub-domain>.<domain>.com
ServerAlias <sub-domain>.<domain>.com
Redirect permanent / https://<sub-domain>.<domain>.com
</VirtualHost>港口: 443
<VirtualHost *:443>
DocumentRoot "/opt/lampp/htdocs/api_tk/public"
<Directory "/opt/lampp/htdocs/api_tk/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName <sub-domain>.<domain>.com
ServerAlias <sub-domain>.<domain>.com
ErrorLog "logs/API-error_log"
CustomLog "logs/API-access_log" common
ProxyPreserveHost On
ProxyRequests Off
ProxyPassMatch /fingerprint http://localhost:5000
ProxyPassReverse /fingerprint http://localhost:5000
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-FOrwarded-Port 443
SSLEngine on
SSLCertificateFile "/opt/lampp/htdocs/ssl_key/svs-file.crt"
SSLCertificateKeyFile "/opt/lampp/htdocs/ssl_key/private_new.key"
SSLCACertificateFile "/opt/lampp/htdocs/ssl_key/svs-bundle-file.crt"
</VirtualHost>443工作正常我可以在浏览器上看到我的HTTPS SSL锁号
但
当我尝试做HTTP请求时
拉勒维尔API总是被毁了。
我有这样的路线
这一切都很好
但是当我尝试像这样做HTTP请求时
http://<sub-domain>.<domain>.com/api/login
最后总是
https://<sub-domain>.<domain>.comapi/login
斜线不见的地方。这是因为我的端口80配置上的redirect permanent。

我的api有这条路。(api.php)
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::post('/timekeeping','Auth\Api\AuthController@timekeeping');
Route::post('/login','Auth\Api\AuthController@login');
Route::middleware('auth:api')->group(function () {
Route::post('/timekeeping_app','Auth\Api\AuthController@timekeeping_app');
Route::post('/logout','Auth\Api\AuthController@logout');
Route::post('/register','Auth\Api\AuthController@register');
Route::post('/show_dtr_list','Auth\Api\AuthController@show_dtr_list');
Route::post('/update','Auth\Api\AuthController@update');
Route::post('/delete','Auth\Api\AuthController@delete');
Route::post('/search_user','Auth\Api\AuthController@search_user');
Route::get('/current_time','Auth\Api\AuthController@current_time');
});我怎么才能阻止这一切?
更新
尝试像这样编辑我的vhost配置
Redirect permanent "/" "https://<sub-domain>.<domain>.com/"
和
Redirect permanent / https://<sub-domain>.<domain>.com\/
但这给了我这样的输出

发布于 2019-12-20 06:31:43
请尝试在apache虚拟主机设置下添加斜杠:
<VirtualHost *:80>
ServerName <sub-domain>.<domain>.com
ServerAlias <sub-domain>.<domain>.com
# fix below
Redirect permanent / https://<sub-domain>.<domain>.com/
</VirtualHost>https://stackoverflow.com/questions/59420720
复制相似问题