【问题标题】:laravel 5 - 403 error on form postlaravel 5 - 表单发布上的 403 错误
【发布时间】:2016-06-16 00:00:23
【问题描述】:

人流量大,

以下通用表单无法正确发布,返回 403 禁止错误。

但是,当从value= 字段中删除随机文本块时,它可以发布。

<form method="POST" action="http://domain.com/generic" accept-charset="UTF-8">

<input type="hidden" name="items" value="[{&quot;sku&quot;:&quot;ttwvslyvjblc&quot;,&quot;name&quot;:&quot;5 on 5 - 1 hour indoor (Loose Cannons)&quot;,&quot;price&quot;:14,&quot;quantity&quot;:1,&quot;detail&quot;:{&quot;utc_offset&quot;:36000000,&quot;venue&quot;:{&quot;country&quot;:&quot;au&quot;,&quot;localized_country_name&quot;:&quot;Australia&quot;,&quot;city&quot;:&quot;Kensington&quot;,&quot;address_1&quot;:&quot;Corner of Kensington Road and Altona Street&quot;,&quot;name&quot;:&quot;YMCA Kensington Community Recreation Centre &quot;,&quot;lon&quot;:144.924556,&quot;id&quot;:1412922,&quot;lat&quot;:-37.795941,&quot;repinned&quot;:false},&quot;rsvp_limit&quot;:14,&quot;headcount&quot;:0,&quot;visibility&quot;:&quot;public_limited&quot;,&quot;waitlist_count&quot;:0,&quot;created&quot;:1461736046000,&quot;fee&quot;:{&quot;amount&quot;:14,&quot;accepts&quot;:&quot;paypal&quot;,&quot;description&quot;:&quot;per person&quot;,&quot;currency&quot;:&quot;AUD&quot;,&quot;label&quot;:&quot;Price&quot;,&quot;required&quot;:&quot;1&quot;},&quot;maybe_rsvp_count&quot;:0,&quot;description&quot;:&quot;<p>*Please note that this session is for advanced players only with the title Loose Cannons*</p> <p>Each week we play a friendly competitive game of basketball. There is a half time break of 2 mins where teams have the chance to discuss strategies. We have a 4 minute substitution which is notified with a whistle. Maximise your fitness each game while we pump some tunes!</p> <p>Points are totalled and the team with the most wins.</p> <p>Some of our members are casual, while many are regular, this creates a dynamic mix of friends and new faces, this <a href=\&quot;http://www.basketball613.com.au/code-of-conduct/\&quot;>culture</a> is what separates Basketball613 apart from standard league competition basketball.</p> <p>The rules are refereed by the players, for the players. We use the FIBA rule system.</p> <p>Coloured sashes are provided to players to identify which team you'r on, so you just need to bring comfortable clothes.</p> <p>If you are attending a game for the first time, you will be allocated to the Intermediate/beginners session to start of with. We will then assess and allocate you to the appropriate skill level game after your first game. To find out which group you have been allocated to, please view your profile title before you book in your next session. When you arrive ask reception where the basketball courts are.</p> <p>Payment is made online, preferably 1 week in advance.</p> <p>Facilities: Showers, Parking, Trains, Drinking Water.</p>&quot;,&quot;how_to_find_us&quot;:&quot;When you arrive ask reception where the basketball courts are.&quot;,&quot;event_url&quot;:&quot;http://www.meetup.com/basketball613/events/231502076/&quot;,&quot;yes_rsvp_count&quot;:6,&quot;duration&quot;:3600000,&quot;announced&quot;:false,&quot;name&quot;:&quot;5 on 5 - 1 hour indoor (Loose Cannons)&quot;,&quot;id&quot;:&quot;ttwvslyvjblc&quot;,&quot;time&quot;:1467104400000,&quot;updated&quot;:1461817693000,&quot;group&quot;:{&quot;join_mode&quot;:&quot;open&quot;,&quot;created&quot;:1358743637000,&quot;name&quot;:&quot;Melbourne Basketball 613&quot;,&quot;group_lon&quot;:144.96000671387,&quot;id&quot;:6760582,&quot;urlname&quot;:&quot;basketball613&quot;,&quot;group_lat&quot;:-37.810001373291,&quot;who&quot;:&quot;Ballers&quot;},&quot;status&quot;:&quot;upcoming&quot;,&quot;numspotsleft&quot;:8,&quot;url&quot;:&quot;http://api.basketball613.com.au/members-area/event/ttwvslyvjblc&quot;,&quot;date&quot;:{&quot;date_usa&quot;:&quot;06-28-2016&quot;,&quot;date_aus&quot;:&quot;28-06-2016&quot;,&quot;time&quot;:&quot;07:00pm&quot;,&quot;day&quot;:&quot;28&quot;,&quot;monthname&quot;:&quot;Jun&quot;,&quot;dayname&quot;:&quot;Tuesday&quot;},&quot;quantity&quot;:1}}]">           
<input class="btn btn-flat btn-success" type="submit" value="Checkout to play!">  
</form>

路线有效:

Route::post('/generic', function() {
        dd('ok!');
});

注意:我已禁用 csrf 以隔离问题。

为什么我无法收到已发布的输入项?

为什么要创建403 Forbidden Access to this resource on the server is denied!

【问题讨论】:

    标签: php forms laravel post http-status-code-403


    【解决方案1】:

    这原来是服务器上的问题。

    mod_security 在某个时候已更新,需要将域列入白名单。

    【讨论】:

    • 能否请您告诉我如何将我的域列入白名单,因为我也遇到了这个错误。我正在使用共享主机 cPanel。
    • 是的,我也遇到了这个错误。在xamp ins 中!但是当我公开到共享主机时出现错误 403,请求值是代码 html。就像 youtube 嵌入代码是错误的,但纯文本是可以的,那么我该如何解决呢?
    【解决方案2】:

    为您的路线:

     route::post('generic',['as' => 'generic'],function() {
    
    
    });
    

    您的表单代码:

    <form method="POST" action="{{route('generic')}}" accept-charset="UTF-8">
    
    <input type="hidden" name="items" value="your value">           
    <input class="btn btn-flat btn-success" type="submit" value="Checkout to play!">  
    </form>
    

    希望对你有帮助

    【讨论】:

    • 没有路由工作,表单工作,这与输入有关
    • ok 试试 在你的隐藏输入的 value 属性中
    • 我不能,因为我在单击按钮后直接得到 403。有趣的是它适用于我的开发(宅基地)但不适用于生产。
    • 大声笑,你可以复制并粘贴所有错误消息内容吗?
    • 您需要检查 /usr/local/apache/logs/error_log 的原因。因为它不是 laravel Error ,而是服务器限制。
    猜你喜欢
    • 2016-07-25
    • 2012-07-09
    • 2015-06-19
    • 2019-05-21
    • 2012-12-24
    • 1970-01-01
    • 2016-02-05
    • 1970-01-01
    • 2017-12-05
    相关资源
    最近更新 更多