簡體   English   中英

為什么我在沒有 CSRF 令牌的情況下在 Laravel 的 HTTP 帖子上得到 301 響應?

[英]Why do I get a 301 response on HTTP post to Laravel without CSRF token?

我正在嘗試在我的網店中設置 Adyen 通知。
https://docs.adyen.com/development-resources/notifications/understand-notifications

當我使用 Adyen 測試頁面測試 HTTP 帖子時,我得到 301 響應,但是當我使用自定義表單測試 HTTP 帖子時,路由有效。

web.php 中的路由:
Route::name('shop.checkout.adyen-notification')->post('/adyen-notification', 'Shop\\CheckoutController@adyenNotification');

VerifyCsrfToken.php 中的設置:
protected $except = ['*/adyen-notification?*'];

自定義表格:

<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE&currency=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099">
    <input type="submit" value="SUBMIT">
</form>

我不明白為什么它給了我 301 響應。

您的表單操作中有拼寫錯誤,缺少右引號:

<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE&currency=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099>
    <input type="submit" value="SUBMIT">
</form>

應該:

<form method="post" action="https://example.com/adyen-notification?originalReference=&reason=&merchantAccountCode=Test&eventCode=NOTIFICATIONTEST&operations=&success=true&paymentMethod=bankTransfer_BE&currency=EUR&pspReference=test_NOTIFICATIONTEST_1&merchantReference=testMerchantRef1&value=11099">
    <input type="submit" value="SUBMIT">
</form>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM