PUT请求403禁止 [英] PUT request 403 Forbidden

查看:1341
本文介绍了PUT请求403禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用laravel开发API.

Developing an API using laravel.

在PUT请求中获取403禁止.

Getting 403 Forbidden on PUT request.

可在远程服务器上工作,但不能在本地工作.在本地服务器上使用MAMP.

Works on a remote server but not locally. Using MAMP for the local server.

这是我的虚拟主机,我什么都没看到.

Here is my virtual host, I don't see anything off.

<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot "/Users/dg/Documents/Websites/domain.com/public_html/dev/public_html" ServerName domain.local ServerAlias www.domain.local <Directory /> Options Indexes FollowSymLinks AllowOverride All </Directory> ErrorLog "/Users/dg/Documents/Websites/domain.com/public_html/dev/error_log" CustomLog "/Users/dg/Documents/Websites/domain.com/public_html/dev/access_log" common </VirtualHost>

<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot "/Users/dg/Documents/Websites/domain.com/public_html/dev/public_html" ServerName domain.local ServerAlias www.domain.local <Directory /> Options Indexes FollowSymLinks AllowOverride All </Directory> ErrorLog "/Users/dg/Documents/Websites/domain.com/public_html/dev/error_log" CustomLog "/Users/dg/Documents/Websites/domain.com/public_html/dev/access_log" common </VirtualHost>

我已经在SO上查看了其他类似的问题,但还没有解决方案.

I've looked at other similar questions on SO but no solution yet.

推荐答案

在此处找到解决方案:

Found the solution here: https://serverfault.com/questions/275512/put-request-results-in-403-forbidden-need-apache-to-allow-put-requests

在文档根目录的.htaccess中添加了以下内容:

Added the following to .htaccess at the document root:

<Limit GET POST PUT DELETE HEAD OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST PUT DELETE HEAD OPTIONS> Order deny,allow Deny from all </LimitExcept>

<Limit GET POST PUT DELETE HEAD OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST PUT DELETE HEAD OPTIONS> Order deny,allow Deny from all </LimitExcept>

这篇关于PUT请求403禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆