DevOps/πŸ“Œ Issue!

Elastic beanstalkμ—μ„œ Environment health has transitioned from Ok to Severe. 100 % of the requests are erroring with HTTP 4xx μ—λŸ¬κ°€ 뜰 λ•Œ

Alchemists 2023. 2. 9. 19:50
728x90

둜그λ₯Ό ν™•μΈν•΄λ³΄λ‹ˆ λ‘œλ“œλ²¨λŸ°μ‹± μƒνƒœν™•μΈμ΄ 계속 404κ°€ λ–΄λ‹€. κ³΅μ‹λ¬Έμ„œλ₯Ό λ³΄λ‹ˆκΉŒ μƒνƒœμ½”λ“œλ₯Ό λ°˜ν™˜ν•˜μ§€ μ•Šμ•„μ„œ 인것 κ°™μ•˜λ‹€.

 

Target.ResponseCodeMismatch

μ„€λͺ…: μƒνƒœ 확인이 μ˜ˆμƒ HTTP μ½”λ“œλ₯Ό λ°˜ν™˜ν•˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

ν•΄κ²° 방법:

  • 성곡 μ½”λ“œλŠ” λŒ€μƒμœΌλ‘œλΆ€ν„° 성곡적인 응닡을 확인할 λ•Œ μ‚¬μš©ν•˜λŠ” HTTP μ½”λ“œμž…λ‹ˆλ‹€. 200~499 μ‚¬μ΄μ˜ κ°’ λ˜λŠ” κ°’ λ²”μœ„λ₯Ό μ§€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 기본값은 200μž…λ‹ˆλ‹€. λ‘œλ“œ λ°ΈλŸ°μ„œ μƒνƒœ 확인 ꡬ성을 ν™•μΈν•˜μ—¬ μˆ˜μ‹ ν•  κ²ƒμœΌλ‘œ μ˜ˆμƒλ˜λŠ” 성곡 μ½”λ“œλ₯Ό ν™•μΈν•˜μ‹­μ‹œμ˜€. 그런 λ‹€μŒ, μ›Ή μ„œλ²„ μ•‘μ„ΈμŠ€ 둜그λ₯Ό κ²€μ‚¬ν•˜μ—¬ μ˜ˆμƒ 성곡 μ½”λ“œκ°€ λ°˜ν™˜λ˜λŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€. ν•„μš”μ— 따라 μ„±κ³΅ μ½”λ“œ 값을 μˆ˜μ •ν•˜μ‹­μ‹œμ˜€.
  • ping κ²½λ‘œκ°€ μœ νš¨ν•œμ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€. ping κ²½λ‘œλŠ” μƒνƒœ 확인을 μœ„ν•œ λŒ€μƒμ— λŒ€ν•œ λŒ€μƒμž…λ‹ˆλ‹€. λ°˜λ“œμ‹œ μœ νš¨ν•œ URI(/path?query)λ₯Ό μ§€μ •ν•˜μ‹­μ‹œμ˜€. 기본값은 /μž…λ‹ˆλ‹€. ν•„μš”μ— 따라 ping 경둜 값을 μˆ˜μ •ν•˜μ‹­μ‹œμ˜€.

 

https://stackoverflow.com/questions/45433097/environment-health-has-transitioned-from-ok-to-severe-81-8-of-the-requests-ar

 

Environment health has transitioned from Ok to Severe. 81.8 % of the requests are erroring with HTTP 4xx

I would like to ask for help about Elastic Beanstalk error: Environment health has transitioned from Ok to Severe. 81.8 % of the requests are erroring with HTTP 4xx. I read some articles here and I

stackoverflow.com

μ € stack overflow κΈ€ λŒ€λ‘œ

4xxμ—λŸ¬λ₯Ό λ¬΄μ‹œν•˜λŠ” conf νŒŒμΌμ„ .ebextensions ν•˜μœ„μ— μž‘μ„±ν–ˆλ‹€.

.ebextensions/.ebextensions/healthd_ignore_4xx.config

   files:
   "/etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy.conf":
   mode: "000644"
   owner: root
   group: root
   content: |
     # modification No.1
      map $status $logflag {
          404 0;
          403 0;
          default 1;
      }

      map $http_upgrade $connection_upgrade {
          default        "upgrade";
          ""            "";
      }

      server {
          listen 80;

          gzip on;
              gzip_comp_level 4;
              gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

          if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
              set $year $1;
              set $month $2;
              set $day $3;
              set $hour $4;
          }

          # modification No.2
          # access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;
            access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd if=$logflag;

          access_log    /var/log/nginx/access.log;

          location / {
              proxy_pass            http://docker;
              proxy_http_version    1.1;

              proxy_set_header    Connection            $connection_upgrade;
              proxy_set_header    Upgrade                $http_upgrade;
              proxy_set_header    Host                $host;
              proxy_set_header    X-Real-IP            $remote_addr;
              proxy_set_header    X-Forwarded-For        $proxy_add_x_forwarded_for;
          }
      }

 

λ‚˜ 같은 κ²½μš°λŠ” μŠ€ν”„λ§λΆ€νŠΈ ν”„λ‘œμ νŠΈλ₯Ό λ°°ν¬ν•˜κ³  μžˆμ—ˆλ‹€.

이 ν”„λ‘œμ„ΈμŠ€λ₯Ό 보면 μƒνƒœκ²€μ‚¬ κ²½λ‘œκ°€ / (루트 경둜) 이닀. κ·Έλž˜μ„œ μŠ€ν”„λ§λΆ€νŠΈ ν”„λ‘œμ νŠΈμ—μ„œλ„ "/"λ₯Ό URI둜 κ°€μ§€λŠ” apiλ₯Ό ν•˜λ‚˜ λ§Œλ“€μ–΄μ€¬λ”λ‹ˆ νŒŒλž€λΆˆμ΄ λ“€μ–΄μ™”λ‹€!

 

λ‘œλ“œ λ²¨λŸ°μ‹±.. μ–΄λ ΅λ‹€.. 휴

728x90