laravel 5 - 表单 post 出现 403 错误

laravel 5 - 403 error on form post

优秀的stack over flow人,

以下通用表单无法 post 正确,returns 403 禁止错误。

然而,当从 value= 字段中删除随机文本块时,它可以 post。

<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 以隔离问题。

为什么我无法收到 post 输入的项目?

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

您的路线:

 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>

希望能帮到你

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

mod_security 已更新,需要将域列入白名单。