【问题标题】:Getting 301 moved permanently response on Laravel API post request在 Laravel API 发布请求上获得 301 永久移动响应
【发布时间】:2017-12-15 16:11:31
【问题描述】:

我已经在 Digitalocean LAMP 上部署了 Laravel REST API 应用程序。我使用 Angular 4 作为前端。当我向 API 发出发布请求时,我得到一个 301 Moved 永久响应。如果我通过高级 REST API 客户端发送所需并且在本地开发设置上也能正常工作,它工作正常。

CORS 已经在 Laravel 上设置好了。

这里的任何建议都会非常有用。目前只在 Chrome 上试用过

【问题讨论】:

    标签: angular laravel laravel-5.4


    【解决方案1】:

    试试这个:

      <IfModule mod_rewrite.c>
       <IfModule mod_negotiation.c>
          Options -MultiViews
       </IfModule>
    
       php_flag opcache.enable Off
    
       RewriteEngine On
    
       # Redirect Trailing Slashes If Not A Folder…
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^(.*)/$ /$1 [L,R=307]
    
       # Handle Front Controller…
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^ index.php [L]
    
       # Handle Authorization Header
       RewriteCond %{HTTP:Authorization} .
       RewriteRule .* — [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    </IfModule>
    

    Laravel return empty response / laravel 301 Moved Permanently

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-18
      • 2017-09-04
      • 2018-06-23
      • 2016-06-08
      • 2021-09-19
      • 1970-01-01
      • 2019-11-04
      • 2012-07-10
      相关资源
      最近更新 更多