Forum Linux.général nginx:recv() failed (104: Connection reset by peer) while reading response header from upstream

Posté par . Licence CC by-sa.
0
29
juin
2016

Hello tout le monde,

J'ai un problème avec mon serveur nginx configuré en reverse proxy.
Il ne charge pas totalement la page de mon application.

Quand je consulte les logs d'erreur voici ce que j'ai

[root@prd-nginx ~]# tail -f /var/log/nginx/error.log
2016/06/29 17:36:58 [error] 2623#0: *4 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.92.72.13, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.&dpi=96", host: "bi.mycompagny.fr", referrer: "https://bi.mycompagny.fr/index.htm"
2016/06/29 17:37:44 [error] 2623#0: *45 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:38:54 [error] 2623#0: *58 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:41:58 [error] 2623#0: *62 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:42:01 [error] 2623#0: *70 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:42:41 [error] 2623#0: *67 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:43:30 [error] 2623#0: *68 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:43:32 [error] 2623#0: *95 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:43:44 [error] 2623#0: *68 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:43:45 [error] 2623#0: *70 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:44:55 [error] 2623#0: *133 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:45:07 [error] 2623#0: *129 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:45:08 [error] 2623#0: *132 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"
2016/06/29 17:45:08 [error] 2623#0: *126 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.12.27.76, server: bi.mycompagny.fr, request: "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1", upstream: "http://10.33.95.37:80/qlikview/QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96", host: "bi.mycompagny.fr:8080", referrer: "https://bi.mycompagny.fr:8080/index.htm"

[root@prd-nginx ~]# tail -f /var/log/nginx/access.log
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1" 502 574 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /index.htm HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /global.css HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /custom.css HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /js/jquery-1.7.min.js HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /images/ajax-loader.gif HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /js/login.js HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /js/accessPoint.js HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "GET /images/logo_main.png HTTP/1.1" 304 0 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
103.12.27.76 - - [29/Jun/2016:17:54:08 +0200] "POST /QvAJAXZfc/AccessPoint.aspx?mark=&platform=browser.chrome&dpi=96 HTTP/1.1" 502 574 "https://bi.mycompagny.fr:8080/index.htm" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"

  • # cherche cote "upstream"

    Posté par . Évalué à 1.

    tu dois avoir un pb de timeout, voire de plantage, du cote de ton serveur asp

  • # J'ai trouvé des histoire de buffer

    Posté par . Évalué à 1.

    Voici mon fichier /etc/nginx/nginx.conf

    user nginx;
    worker_processes auto; # Set to number of CPU cores

    error_log /var/log/nginx/error.log;

    pid /run/nginx.pid;

    events {
    worker_connections 2048;
    use epoll;
    multi_accept on;
    }

    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 /var/log/nginx/access.log main;

    sendfile on;

    keepalive_timeout 65;
    keepalive_requests 100000;
    tcp_nopush on;
    tcp_nodelay on;
    client_body_buffer_size 128k;
    client_max_body_size 10m;
    client_header_buffer_size 1k;
    large_client_header_buffers 4 4k;
    output_buffers 1 32k;
    postpone_output 1460;
    client_header_timeout 3m;
    client_body_timeout 3m;
    send_timeout 3m;
    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 5;
    open_file_cache_errors off;
    gzip on;
    gzip_min_length 1000;
    gzip_buffers 4 4k;

    include /etc/nginx/conf.d/*.conf;

    index index.html index.htm;
    }

  • # Problème solutionné

    Posté par . Évalué à 1.

    Bon mon probleme est résolu.
    Il y avait plusieurs problèmes:

    Le nginx se trouve derriere un FW qui faisait un NAT + un port forward du port 8443 vers 443 et dans l'URL je n'ai pas trouvé comment conserver le port à chaque appel HTTP.
    J'ai donc choisi de faire une formward 443 vers 443 ainsi pas besoin de prciser le port dans l'URL.

    Ensuite dans mon fichier de conf des "vhost" nginx j'avais fait un proxy pass en indiquant http://mysrv/myappli.
    En virant le /myappli et en le faisant saisir dans l'url "virtuelle" les autres appel http en dehors de myappli fonctionnent.

    • [^] # Re: Problème solutionné

      Posté par . Évalué à 2.

      Bonsoir,

      il y a des variables dispo dans nginx.
      Il doit bien y en avoir une avec un nom relatif au port.

      Ensuite, pour l'IP, regarde ce qui se fait avec les mots-clefs : real_ip et x_forward_ip
      Dans ton proxy pass, tu ajoutes un paramètre qui va ressembler à Host = $host

      Voilà

Suivre le flux des commentaires

Note : les commentaires appartiennent à ceux qui les ont postés. Nous n'en sommes pas responsables.