T
T
twixoff2015-05-20 13:58:43
Yii
twixoff, 2015-05-20 13:58:43

External service can't get page on yii2?

In general, there is yii2 that works not from the root, but in the /coupons folder. There are redirects in .htaccess to make everything work.
There is a page /coupons/cart/payment that works through the browser.
There is a banking gateway that, upon successful payment, sends a POST request to the /coupons/cart/payment address and receives a 400 error. Here is the server log:

193.93.56.240 - - [20/May/2015:11:43:31 +0300] "POST /coupons/cart/payment HTTP/1.0" 400 16683 "-" "Java/1.6.0_35"

If you put the file in the root and send a request to it (for example /coupons/result.php), then everything works.
/www/coupons/.htaccess
RewriteEngine on
RewriteRule ^static(.*)$ /coupons/web/static$1 [L]
RewriteRule ^uploads(.*)$ /coupons/web/uploads$1 [L]
RewriteRule ^assets(.*)$ /coupons/web/assets$1 [L]
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/].*)?$ /coupons/web/index.php$1

/www/coupons/web/.htaccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

Question - how to make sure that there is no 400 error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
twixoff, 2015-05-20
@twixoff

Everything turned out to be simple - you need to disable the csrf check for the controller:
www.yiiframework.com/doc-2.0/yii-web-controller.ht...

M
Maxim Grechushnikov, 2015-05-20
@maxyc_webber

destroy what?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question