programing

업스트림에서 응답 헤더를 읽는 동안 업스트림에서 너무 큰 헤더가 전송되었습니다.

prostudy 2022. 9. 9. 08:59
반응형

업스트림에서 응답 헤더를 읽는 동안 업스트림에서 너무 큰 헤더가 전송되었습니다.

다음과 같은 오류가 발생합니다.

2014/05/24 11:49:06 [error] 8376#0:*54031 업스트림에서 업스트림 클라이언트: 107.21.19.210, 서버: aamjanata.com, 요청: "GET /the-the-wash-chronicles - sponsupported - by - gujarat - government / % , % 20:/"aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-by-gujarat-government/,%20wash:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-spons:/aamjanata.com/the-brainwash-chronicles-sponsgujarat-government/,%20files:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-govern:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20flash:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https://aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash-chronicles-sponsored-by-gujarat-government/,%20https:/aamjanata.com/the-brainwash- 구자라트 정부에 의한 연대기 후원/,%20ht

항상 똑같아요.쉼표로 몇 번이고 반복되는 URL입니다.원인이 무엇인지 알 수 없습니다.생각나는 사람?

업데이트: 다른 오류:

http request count is zero while sending response to client

설정은 다음과 같습니다.그 밖에 관련 없는 것이 있습니다만, 이 부분은 추가/편집되었습니다.

fastcgi_cache_path /var/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;
    # Upstream to abstract backend connection(s) for PHP.
    upstream php {
            #this should match value of "listen" directive in php-fpm pool
            server unix:/var/run/php5-fpm.sock;
    }

다음으로 서버 블록에서 $skip_cache 0을 설정합니다.

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
            set $skip_cache 1;
    }
    if ($query_string != "") {
            set $skip_cache 1;
    }

    # Don't cache uris containing the following segments
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
            set $skip_cache 1;
    }

    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
            set $skip_cache 1;
    }

    location / {
            # This is cool because no php is touched for static content.
            # include the "?$args" part so non-default permalinks doesn't break when using query string
            try_files $uri $uri/ /index.php?$args;
    }


    location ~ \.php$ {
            try_files $uri /index.php;
            include fastcgi_params;
            fastcgi_pass php;
            fastcgi_read_timeout 3000;

            fastcgi_cache_bypass $skip_cache;
            fastcgi_no_cache $skip_cache;

            fastcgi_cache WORDPRESS;
            fastcgi_cache_valid  60m;
    }

    location ~ /purge(/.*) {
        fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
    }`

conf 파일에 다음 추가

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;

nginx가 프록시/리버스 프록시로서 실행되고 있는 경우

즉, 사용자용입니다.ngx_http_proxy_module

★★★★★★★★★★★★★★★★ fastcgi , . . . . . . . .proxy버퍼에 합니다.

이 때, 이 때, 이 때 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 이, 즉,proxy_buffer_sizeproxy_buffers또는 완전히 비활성화합니다(nginx 매뉴얼을 참조하십시오).

프록시 버퍼링 설정 예시

http {
  proxy_buffer_size   128k;
  proxy_buffers   4 256k;
  proxy_busy_buffers_size   256k;
}

프록시 버퍼를 디세블로 하는 예(긴 폴링 서버에 권장)

http {
  proxy_buffering off;
}

상세한 것에 대하여는, 다음을 참조해 주세요.Nginx 프록시 모듈 매뉴얼

PLESK 설명

여기 있는 상위 두 개의 답을 합친 것입니다.

Plesk 12에서는 nginx를 리버스 프록시로 실행하고 있었습니다(디폴트인 것 같습니다).따라서 nginx도 프록시로 실행되고 있기 때문에 현재 상위 답변이 작동하지 않습니다.

는 ㅇㅇㅇㅇㅇ에.Subscriptions | [subscription domain] | Websites & Domains (tab) | [Virtual Host domain] | Web Server Settings.

그 후 페이지 하단에서 Additional nginx 디렉티브를 설정할 수 있습니다.여기서 상위2개의 답변의 조합으로 설정합니다.

fastcgi_buffers         16  16k;
fastcgi_buffer_size         32k;
proxy_buffer_size          128k;
proxy_buffers            4 256k;
proxy_busy_buffers_size    256k;

upstream sent too big header while reading response header from upstream입니다.nginx는 "있는 들지 않는다"고 말합니다 '이렇게 하다.

  1. 업스트림 서버 스레드가 크래시되었습니다.
  2. 업스트림서버가 유효하지 않은 헤더를 반환했습니다.
  3. STDERR에서 반환된 알림/경고가 버퍼를 오버플로하여 해당 버퍼와 STDOUT가 모두 닫혔습니다.

3: 메시지 위에 있는 에러 로그를 확인합니다.메시지 앞에 기록된 행과 함께 스트리밍이 이루어지고 있습니까? PHP message: PHP Notice: Undefined index:「 」 、 「 」 、 「 」:

2015/11/23 10:30:02 [error] 32451#0: *580927 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: Firstname in /srv/www/classes/data_convert.php on line 1090
PHP message: PHP Notice:  Undefined index: Lastname in /srv/www/classes/data_convert.php on line 1090
... // 20 lines of same
PHP message: PHP Notice:  Undefined index: Firstname in /srv/www/classes/data_convert.php on line 1090
PHP message: PHP Notice:  Undefined index: Lastname in /srv/www/classes/data_convert.php on line 1090
PHP message: PHP Notice:  Undef
2015/11/23 10:30:02 [error] 32451#0: *580927 FastCGI sent in stderr: "ta_convert.php on line 1090
PHP message: PHP Notice:  Undefined index: Firstname

아래 세 번째 줄에서 버퍼 제한이 히트, 파손 및 그 위에 다음 스레드가 기입된 것을 알 수 있습니다.그런 다음 Nginx는 연결을 닫고 클라이언트에 502를 반환합니다.

2: 요구별로 송신된 모든 헤더를 기록하고, 그것들을 확인하여 표준에 준거하고 있는지 확인합니다(nginx는 24시간 이상 경과한 쿠키를 삭제/삭제하는 것을 허용하지 않습니다.콘텐츠 카운트 전에 에러 메시지가 버퍼링되었기 때문에 유효하지 않은 콘텐츠 길이를 송신합니다).getallheaders 함수 호출은 보통 추상화된 코드 상황에서 도움이 됩니다.php 모든 헤더를 가져옵니다.

예를 들어 다음과 같습니다.

<?php
//expire cookie
setcookie ( 'bookmark', '', strtotime('2012-01-01 00:00:00') );
// nginx will refuse this header response, too far past to accept
....
?>

또, 이하와 같이 됩니다.

<?php
header('Content-type: image/jpg');
?>

<?php   //a space was injected into the output above this line
header('Content-length: ' . filesize('image.jpg') );
echo file_get_contents('image.jpg');
// error! the response is now 1-byte longer than header!!
?>

1: 검증 또는 스크립트로그를 작성하여 스레드가 올바른 엔드 포인트에 도달하고 완료 전에 종료되지 않았는지 확인합니다.

EBS에 django 애플리케이션을 배포하고 있으며 64비트 Amazon Linux 2에서 실행되는 Python 3.8을 사용하고 있습니다.다음 방법이 효과적이었습니다(이전 Linux 버전을 사용하는 경우 폴더 구조가 다를 수 있습니다).자세한 내용은 여기를 참조하십시오.

만들어 보세요..platform폴더와 그 서브디렉토리를 다음에 나타냅니다.

|-- .ebextensions          # Don't put nginx config here
|   |-- django.config        
|-- .platform              # Make ".platform" folder and its subfolders
    |-- nginx                
    |   -- conf.d
    |       -- proxy.conf

proxy.conf 파일은 .ebextensions 폴더 또는 .elastic beanstalk 폴더가 아닌 .platform 폴더에 배치해야 합니다.확장자는 .conf NOT .config 끝나야 합니다.

proxy.conf 파일 내에서 다음 행을 직접 복사하여 붙여넣습니다.

client_max_body_size 50M;
large_client_header_buffers 4 32k;
fastcgi_buffers 16 32k;
fastcgi_buffer_size 32k;
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

nginx를 재시작하기 위해 명령어를 발행할 필요가 없습니다(Amazon Linux 2의 경우).

Elastic Beanstalk에 소스 코드를 다시 배포합니다.

우리는 이 현상이 발생한 1대의 서버가 fpm 설정을 파괴하여 보통 디스크에 기록되는 php 오류/경고/통지가 FCGI 소켓을 통해 전송된다는 것을 알게 되었습니다.헤더의 일부가 버퍼 청크로 분할되면 해석 오류가 발생하는 것 같습니다.

설정 ★★php_admin_value[error_log]됩니다.

보다 작은 스크립트로 문제를 재현할 수 있습니다.

<?php
for ($i = 0; $i<$_GET['iterations']; $i++)
    error_log(str_pad("a", $_GET['size'], "a"));
echo "got here\n";

버퍼를 올리면 502는 히트하기 어려워지지만 불가능하지는 않습니다.예를 들어 다음과 같습니다.

bash-4.1# for it in {30..200..3}; do for size in {100..250..3}; do echo "size=$size iterations=$it $(curl -sv "http://localhost/debug.php?size=$size&iterations=$it" 2>&1 | egrep '^< HTTP')"; done; done | grep 502 | head
size=121 iterations=30 < HTTP/1.1 502 Bad Gateway
size=109 iterations=33 < HTTP/1.1 502 Bad Gateway
size=232 iterations=33 < HTTP/1.1 502 Bad Gateway
size=241 iterations=48 < HTTP/1.1 502 Bad Gateway
size=145 iterations=51 < HTTP/1.1 502 Bad Gateway
size=226 iterations=51 < HTTP/1.1 502 Bad Gateway
size=190 iterations=60 < HTTP/1.1 502 Bad Gateway
size=115 iterations=63 < HTTP/1.1 502 Bad Gateway
size=109 iterations=66 < HTTP/1.1 502 Bad Gateway
size=163 iterations=69 < HTTP/1.1 502 Bad Gateway
[... there would be more here, but I piped through head ...]

fastcgi_buffers 16 16k; fastcgi_buffer_size 32k;:

bash-4.1# for it in {30..200..3}; do for size in {100..250..3}; do echo "size=$size iterations=$it $(curl -sv "http://localhost/debug.php?size=$size&iterations=$it" 2>&1 | egrep '^< HTTP')"; done; done | grep 502 | head
size=223 iterations=69 < HTTP/1.1 502 Bad Gateway
size=184 iterations=165 < HTTP/1.1 502 Bad Gateway
size=151 iterations=198 < HTTP/1.1 502 Bad Gateway

따라서 정답은 fpm 구성을 수정하여 디스크에 오류를 기록하는 것입니다.

추가:

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

nginx.conf의 서버 {}에게

저는 좋아요.

도커 컨테이너에서 Symfony 앱을 php-fpm 및 nginx에서 실행할 때 동일한 문제에 직면했습니다.

syfony에 중복되어 있습니다.docker logs php-fpm:

[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: "NOTICE: PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\DisallowRobotsIndexingListener::onResponse"."
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: "NOTICE: PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\StreamedResponseListener::onKernelResponse"."
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: "NOTICE: PHP message: [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelFinishRequest"."
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: "NOTICE: PHP message: [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelFinishRequest"."
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: "NOTICE: PHP message: [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleAwareListener::onKernelFinishRequest"."
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: "NOTICE: PHP message: [debug] Notified event "kernel.terminate" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelTerminate"."
[09-Jul-2021 12:25:46] WARNING: [pool www] child 38 said into stderr: ""

★★★★★★★★★★★★★★★★★」docker logs nginx:

2021/07/09 12:25:46 [error] 30#30: *2 FastCGI sent in stderr: "ller" to listener "OblgazAPI\API\Common\Infrastructure\EventSubscriber\LegalAuthenticationChecker::checkAuthentication".

PHP message: [debug] Notified event "kernel.controller_arguments" to listener "Symfony\Component\HttpKernel\EventListener\ErrorListener::onControllerArguments".

PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse".

PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelResponse".

PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse".

PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse".

PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\DisallowRobotsIndexingListener::onResponse".

PHP message: [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\StreamedResponseListener::onKernelResponse".

PHP message: [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelFinishRequest".

PHP message: [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelFinishRequest".

PHP message: [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleAwareListener::onKernelFinishRequest".

PHP message: [debug] Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ErrorListener::logKernelException".

PHP message: [debug] Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelException".

그리고 nginx 로그는

2021/07/09 12:25:46 [error] 30#30: *2 upstream sent too big header while reading response header from upstream ...

502 에러를 맞혔어요.

' ' '의 'fastcgi_buffer_size에서는 도움이 이것은 것.nginx 설 、 ingin 、 in in 、 in in는는는는는는 。

더 나은 해결책은 Fast CGI로 로그를 전송하기 위해 php-fpm을 비활성화하는 것입니다.해서 만들 수 되었습니다.fastcgi.logging=0php.ini(디폴트로는 1).php docs.

가 훨씬 .docker logs nginx:

172.18.0.1 - - [09/Jul/2021:12:36:02 +0300] "GET /my/symfony/app HTTP/1.1" 401 73 "-" "PostmanRuntime/7.26.8"
172.18.0.1 - - [09/Jul/2021:12:36:04 +0300] "GET /my/symfony/app HTTP/1.1" 401 73 "-" "PostmanRuntime/7.26.8"

모든 php-fpm 로그는 php-fpm 로그에 그대로 남아 있습니다.

fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

숫자를 늘렸을 때 효과가 있었다

Symfony 프레임워크를 사용하는 경우: Nginx 설정을 조작하기 전에 먼저 ChromePHP를 비활성화해 보십시오.

1 - app/config/config_dev.yml 열기

2 - 다음 행에 코멘트합니다.

#chromephp:
    #type:   chromephp
    #level:  info

ChromePHP는 x-ChromePhp-Data 헤더에 json-encoded된 디버깅 정보를 패킹합니다.이것은 fastcgi를 사용한nginx 기본 설정에는 너무 큽니다.

출처 : https://github.com/symfony/symfony/issues/8413#issuecomment-20412848

이 에러를 검색할 때, 이것은 Google에서 가장 높은 SO-Question입니다.자, 이 에러를 검색해 봅시다.

이 오류가 발생하여 NGINX 설정에 즉시 딥 다이브하고 싶지 않은 경우 디버깅콘솔에 출력을 체크할 수 있습니다.저 같은 경우에는 FirePHP/Chromelogger 콘솔에 로딩된 텍스트를 출력하고 있었는데, 모두 헤더로 전송되기 때문에 오버플로가 발생하고 있었습니다.

이 에러가 로그메시지를 대량으로 송신하는 것만으로 발생하는 경우는, Web 서버 설정을 변경할 필요가 없는 경우가 있습니다.

이 문제가 어떤 헤더 php를 송신하고 있는지 확실하지 않습니다.버퍼링이 유효하게 되어 있는 것을 확인합니다.간단한 방법은 proxy.conf 파일을 작성하는 것입니다.

proxy_redirect          off;
proxy_set_header        Host            $host;
proxy_set_header        X-Real-IP       $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size    100m;
client_body_buffer_size 128k;
proxy_connect_timeout   90;
proxy_send_timeout      90;
proxy_read_timeout      90;
proxy_buffering         on;
proxy_buffer_size       128k;
proxy_buffers           4 256k;
proxy_busy_buffers_size 256k;

fascgi.conf 파일:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;
fastcgi_buffers 128 4096k;
fastcgi_buffer_size 4096k;
fastcgi_index  index.php;
fastcgi_param  REDIRECT_STATUS    200;

다음으로 디폴트 컨피규레이션서버에서 다음과 같이 콜해야 합니다.

http {
  include    /etc/nginx/mime.types;
  include    /etc/nginx/proxy.conf;
  include    /etc/nginx/fastcgi.conf;
  index    index.html index.htm index.php;
  log_format   main '$remote_addr - $remote_user [$time_local]  $status '
    '"$request" $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';
  #access_log   /logs/access.log  main;
  sendfile     on;
  tcp_nopush   on;
 # ........
}

Symfony 프로젝트의 경우 .env 파일에 다음 행을 추가하십시오.

SHELL_VERBOSITY=0

https://symfony.com/doc/current/console/verbosity.html

이 내용은 여기서 마치겠습니다.프로젝트에서 이 문제를 디버깅하는 데 엄청난 시간을 소비했기 때문에 이 솔루션만이 100%(적절한 이유로) 성공했기 때문입니다.이 토픽에 관련된 답을 찾을 수 없었습니다.누군가 도움이 될 거야

이 경우 백엔드가 매우 긴 URL을 가진 리다이렉트 응답을 생성했기 때문에 다음 nginx 오류가 발생하였습니다.

HTTP/1.1 301 Moved Permanently 
Location: https://www.example.com/?manyParamsHere...

그냥 궁금해서 그 큰 URL을 파일에 저장했는데 크기가 4.4Kb였습니다.

/etc/nginx/conf.d/some_site.conf하는 데 이 되었습니다.

server {
    # ...
    location ~ ^/index\.php(/|$) {
        fastcgi_pass php-upstream;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        # Add these lines:
        fastcgi_buffer_size 32k;
        fastcgi_buffers 4 32k;
    }
}

이러한 파라미터에 대한 자세한 내용은 공식 nginx 설명서를 참조하십시오.

이 에러가 발생해, 다음의 3개의 수정 방법을 찾았습니다.

  • 세트SHELL_VERBOSITY=0또는 다른 값 < 3 in .env : https://stackoverflow.com/a/69321273/13653732 이 경우 PHP 로그를 비활성화하지만 개발 및 디버깅에 도움이 됩니다.
  • 세트fastcgi.logging=0php.ini위와 같은 결과입니다.
  • Symfony를 5.2에서 5.3으로 업데이트하십시오.나는 이전 버전이 그것에 문제가 있다고 생각한다.

모든 PHP Symfony 로그가 Nginx의 오류로 인식되지만 PHP는 올바르게 작동했습니다.

Nginx 1.17, PHP 8.0.2, PHP-FPM, Symfony 5.2, Xdebug, Docker를 가지고 있었습니다.

새로운 버전 Nginx 1.21, PHP 8.0.14를 시도했지만 아무 결과도 없었습니다.그 문제는 아파치가 아니었어요.

Nginx 설정을 변경했지만 아무 결과도 없었습니다.

Symfony를 사용하고 있기 때문에 (Error Handler를 사용하는 경우) 예외 페이지가 있습니다.그리고 이 메시지는 예외 메시지를 생성된 응답의 헤더로 표시합니다.

vendor/symfony/error-handler/ErrorRenderer/SerializerErrorRenderer.php

헤더는 X-Debug-Exception 입니다.

따라서 매우 큰 예외 메시지를 작성했다면 nginx나 chrome(제한 256k), curl(~128kb) 모두 페이지를 표시할 수 없으며 무엇이 이러한 큰 헤더를 출력하는지 디버깅하기 매우 어렵게 만들 수 없습니다.

nginx 설정에 npaste의 늘어난 버퍼 크기를 무작정 복사하지 말 것을 제안합니다.이러한 현상은 원인이 아닙니다.

언급URL : https://stackoverflow.com/questions/23844761/upstream-sent-too-big-header-while-reading-response-header-from-upstream

반응형