简体   繁体   中英

laravel 5 - 403 error on form post

Good stack over flow people,

The following generic form is failing to post correctly, returns a 403 forbidden error.

however when one removes random chunks of text from the value= field it can 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>

the route works:

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

Note: i have disabled csrf to isolate the issue.

Why am i unable to recieve the posted the input items?

Why is this creating a 403 Forbidden Access to this resource on the server is denied! ?

This turned out to be an issue on the server.

mod_security had updated at some point and the domain needed to be whitelisted.

for your route :

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


});

your form code :

<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>

I hope that can help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM