среда, 22 апреля 2020 г.

Magento rewrite 404 error with checkout

It was dev site with enabled basic auth
Access log displayed 404 error
There was an error in nginx error log
 is not found (2: No such file or directory)

Working Apache config was
<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
</IfModule>

I was moving to Nginx and got an error 404, because I only disabled auth with
location /onestepcheckout/ {
    auth_basic off; 
}
I had to add auth off for checkout, but I forgot about rewrite
try_files $uri/ $uri/ /index.php$is_args$args;
It was a reason.
Resolving error was

location / {     
    try_files $uri/ $uri/ /index.php$is_args$args;
}

location /onestepcheckout/ {
    auth_basic off;
    try_files $uri $uri/ /index.php$is_args$args;
}

# POST response
location /rest/ {
    auth_basic off;
    try_files $uri $uri/ /index.php$is_args$args;
}

Комментариев нет:

Отправить комментарий