TransWikia.com

Код ответа 204 приводит к ошибке

Stack Overflow на русском Asked by McCrack on November 27, 2021

Все запросы со статусом ответа 204 завершаются ошибкой. Без кода ответа и других заголовков

/**
 * Update the specified resource in storage.
 *
 * @param Request $request
 * @param  int  $id
 * @return Response
 */
public function update(Request $request, $id): Response
{
    $user = $this->repository->find($id);
    $this->repository->update(
        $user,
        $request->only(['name','email','password','isActive'])
    );
    $this->repository->save($user);

    return response()->noContent(204);
}

FireFox console

Любые варианты ответов с кодом 204 заканчиваться одинаково.
Приложение запущено из докера, где nginx, fpm и фронт (vue) находятся в отдельных контейнерах.

Конфиг nginx:

user  nginx;
worker_processes  1;
error_log  /dev/stderr warn;
pid        /var/run/nginx.pid;
events { worker_connections  1024; }
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log /dev/stdout  main;
    sendfile on;
    keepalive_timeout 65;
    gzip  on;
    server {
        listen 80;
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Content-Type-Options "nosniff";
        root /var/www/html/public;
        index index.html index.htm index.php;
        charset utf-8;
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
        error_page 404 /index.php;
        location ~ .php$ {
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass clicka:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
        location ~ /.(?!well-known).* {
            deny all;
        }
    }
}

One Answer

Решил проблему путем отказа от Докера

Answered by McCrack on November 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP