I'm having the same problem on redirect from Afterpay payments. Struggling to find the cause of this and Afterpay orders are not going through until this is fixed.
Hi @pkjjalora
Please follow these steps :
What to do if I see "Invalid header line detected" error message when placing an order with Affirm? (https://docs.affirm.com/Integrate_Affirm/Platform_Integration/Magento_2_Integration)
Reason for this error is: We recently upgraded our load balancers from AWS Classic ELB to AWS Application Load Balancer and the new ALB supports both HTTP/1.1 and HTTP/2. As a result, clients that support HTTP/2 will auto upgrade. It's likely that cURL also auto upgrades to HTTP/2, transparently i.e. it sends HTTP/2 request with a HTTP/2 response, on the wire. We use magento's core Zend Framework library for curl request and it does not support HTTP/2. We have plans to switch to another library or Magento's curl in future, to fix the issue for now please follow these instructions to apply patch to add HTTP/2 support to ZF1 library.
1. File path : <magento root>/vendor/magento/zendframework1/library/Zend/Http/Response.php, modify around line 185 : From: if (! preg_match('|^\d\.\d$|', $version)) { To: if (! preg_match('|^\d\.\d$|', $version) && ($version != 2)) { // Hot fix by Affirm 2. File path : <magento root>/vendor/magento/zendframework1/library/Zend/Http/Response.php, modify around line 586 : From: if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+) [1-5]\d+#', $line)) { // Status line; ignore continue; } To: if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+) [1-5]\d+#', $line)) { // Status line; ignore continue; } // Hot fix by Affirm if ($index === 0 && preg_match('#^HTTP/2 200#', $line)) { // Status line; ignore continue; }
I'm having a similar issue with AfterPay on Magento 1.9. Where would I implement this fix as the folder structure is different in 1.9
For AFTERPAY, there is a setting in the M2 admin for fixing this very issue!
Switch to website scope, go to Stores > Configuration > Sales > Payment Methods > AfterPay > Advanced Settings > HTTP Version Header Support
Set to Yes.
I am using Magento 2.2.4 community edition and php 7.0 for online store.
I have added Affirm payment module which i got it from marketplace url - https://marketplace.magento.com/affirm-magento2.html.
From last 5 days i found that when a customer tries to place an order on the website using Affirm payment gateway it is giving me the error i.e. "Invalid header line detected" when it redirects from Affirm payment gateway to success page.
Please find the error as under:
[2018-11-08 16:45:32] main.CRITICAL: Exception message: Invalid header line detected
Trace: #0 /home/cgyruwhd/public_html/vendor/magento/module-payment/Gateway/Command/GatewayCommand.php(102): Astound\Affirm\Gateway\Http\Client\ClientService->placeRequest(Object(Magento\Payment\Gateway\Http\Transfer))
#1 /home/cgyruwhd/public_html/app/code/Astound/Affirm/Gateway/Command/AuthorizeStrategyCommand.php(67): Magento\Payment\Gateway\Command\GatewayCommand->execute(Array)
#2 /home/cgyruwhd/public_html/app/code/Astound/Affirm/Gateway/Command/CaptureStrategyCommand.php(79): Astound\Affirm\Gateway\Command\AuthorizeStrategyCommand->execute(Array)
#3 /home/cgyruwhd/public_html/vendor/magento/module-payment/Model/Method/Adapter.php(546): Astound\Affirm\Gateway\Command\CaptureStrategyCommand->execute(Array)
#4 /home/cgyruwhd/public_html/vendor/magento/module-payment/Model/Method/Adapter.php(461): Magento\Payment\Model\Method\Adapter->executeCommand('capture', Array)
#5 /home/cgyruwhd/public_html/generated/code/Magento/Payment/Model/Method/Adapter/Interceptor.php(362): Magento\Payment\Model\Method\Adapter->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '1164.95')
#6 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(82): Magento\Payment\Model\Method\Adapter\Interceptor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '1164.95')
#7 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice))
#8 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment.php(467): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice))
#9 /home/cgyruwhd/public_html/generated/code/Magento/Sales/Model/Order/Payment/Interceptor.php(180): Magento\Sales\Model\Order\Payment->capture(Object(Magento\Sales\Model\Order\Invoice))
#10 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Invoice.php(344): Magento\Sales\Model\Order\Payment\Interceptor->capture(Object(Magento\Sales\Model\Order\Invoice))
#11 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment/Operations/AbstractOperation.php(73): Magento\Sales\Model\Order\Invoice->capture()
#12 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(30): Magento\Sales\Model\Order\Payment\Operations\AbstractOperation->invoice(Object(Magento\Sales\Model\Order\Payment\Interceptor))
#13 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)
#14 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment.php(467): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)
#15 /home/cgyruwhd/public_html/generated/code/Magento/Sales/Model/Order/Payment/Interceptor.php(180): Magento\Sales\Model\Order\Payment->capture(NULL)
#16 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment.php(448): Magento\Sales\Model\Order\Payment\Interceptor->capture(NULL)
#17 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order/Payment.php(368): Magento\Sales\Model\Order\Payment->processAction('authorize_captu...', Object(Magento\Sales\Model\Order\Interceptor))
#18 /home/cgyruwhd/public_html/generated/code/Magento/Sales/Model/Order/Payment/Interceptor.php(167): Magento\Sales\Model\Order\Payment->place()
#19 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order.php(873): Magento\Sales\Model\Order\Payment\Interceptor->place()
#20 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Order.php(1062): Magento\Sales\Model\Order->_placePayment()
#21 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\Order->place()
#22 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Model\Order\Interceptor->___callParent('place', Array)
#23 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\Order\Interceptor->Magento\Framework\Interception\{closure}()
#24 /home/cgyruwhd/public_html/generated/code/Magento/Sales/Model/Order/Interceptor.php(481): Magento\Sales\Model\Order\Interceptor->___callPlugins('place', Array, Array)
#25 /home/cgyruwhd/public_html/vendor/magento/module-sales/Model/Service/OrderService.php(191): Magento\Sales\Model\Order\Interceptor->place()
#26 /home/cgyruwhd/public_html/vendor/magento/module-quote/Model/QuoteManagement.php(513): Magento\Sales\Model\Service\OrderService->place(Object(Magento\Sales\Model\Order\Interceptor))
#27 /home/cgyruwhd/public_html/vendor/magento/module-quote/Model/QuoteManagement.php(406): Magento\Quote\Model\QuoteManagement->submitQuote(Object(Magento\Quote\Model\Quote), Array)
#28 /home/cgyruwhd/public_html/app/code/Astound/Affirm/Model/Checkout.php(164): Magento\Quote\Model\QuoteManagement->submit(Object(Magento\Quote\Model\Quote))
#29 /home/cgyruwhd/public_html/app/code/Astound/Affirm/Controller/Payment/Confirm.php(97): Astound\Affirm\Model\Checkout->place('2INIOKQK5CJWM11...')
#30 /home/cgyruwhd/public_html/generated/code/Astound/Affirm/Controller/Payment/Confirm/Interceptor.php(24): Astound\Affirm\Controller\Payment\Confirm->execute()
#31 /home/cgyruwhd/public_html/vendor/magento/framework/App/Action/Action.php(107): Astound\Affirm\Controller\Payment\Confirm\Interceptor->execute()
#32 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#33 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Astound\Affirm\Controller\Payment\Confirm\Interceptor->___callParent('dispatch', Array)
#34 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Astound\Affirm\Controller\Payment\Confirm\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#35 /home/cgyruwhd/public_html/generated/code/Astound/Affirm/Controller/Payment/Confirm/Interceptor.php(39): Astound\Affirm\Controller\Payment\Confirm\Interceptor->___callPlugins('dispatch', Array, Array)
#36 /home/cgyruwhd/public_html/vendor/magento/framework/App/FrontController.php(55): Astound\Affirm\Controller\Payment\Confirm\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#37 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#38 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#39 /home/cgyruwhd/public_html/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#40 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#41 /home/cgyruwhd/public_html/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#42 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#43 /home/cgyruwhd/public_html/app/code/Amasty/GeoipRedirect/Plugin/Action.php(260): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#44 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Amasty\GeoipRedirect\Plugin\Action->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#45 /home/cgyruwhd/public_html/app/code/Amasty/InvisibleCaptcha/Plugin/Predispatch.php(93): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#46 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Amasty\InvisibleCaptcha\Plugin\Predispatch->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#47 /home/cgyruwhd/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#48 /home/cgyruwhd/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#49 /home/cgyruwhd/public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#50 /home/cgyruwhd/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#51 /home/cgyruwhd/public_html/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#52 /home/cgyruwhd/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#53 {main} [] []
Kindly suggest.