Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#847·fabio

sometime 404

Author: LeadriveCreated Oct 27, 2021Updated Apr 22, 2026
Labelsneed response

I have three ECS, every ECS had install nginx to access the http request.

My http service use nomad to manage. this is the nomad config.

javascript
job "httpcard" {
  datacenters = ["dc1"]
  type = "service"

  group "httpcardg" {
    count = 3
    network {
      port "http" {
        static = 8482
        to = 8482
      }
    }

    service {
      name = "httpcards"
      tags = ["urlprefix-/"]
      port = "http"
      check {
        name     = "health"
        type     = "http"
        path     = "/api/card/health"
        interval = "10s"
        timeout  = "2s"
      }
    }

    restart {
      attempts = 2
      interval = "30m"
      delay = "15s"
      mode = "fail"
    }

    task "httpcardt" {
      env {
        REDIS_ADDR = "172.16.0.2:6379"
        REDIS_PASSWORD = "xxxx"
      }
      user = "develop"
      driver = "raw_exec"
      config {
        command = "/develop/http_card/httpCard"
      }
    }
  }
}

I want to use fabio to route the request to my http service http_card, so I set the proxy in nginx.conf.

javascript
                location /api/card {
                        proxy_pass http://127.0.0.1:9999/api/card;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                }

/api/card is the URL.

fabio routes will have

javascript
1	httpcards	/	http://172.16.0.4:8482/		33.33%
2	httpcards	/	http://172.16.0.2:8482/		33.33%
3	httpcards	/	http://172.16.0.12:8482/		33.33%

fabio sometime can tranfer the http request, sometime report 404

Source: fabiolb/fabio

View original on GitHubView discussion on GitHub