armor icon indicating copy to clipboard operation
armor copied to clipboard

Host blocks don't appear to work?

Open dragonpaw opened this issue 5 years ago • 0 comments

Recently I was trying to put together a docker container (based on labstack/armor:0.4.14) for several static sites, but no matter what I did, the hosts sections didn't seem to be getting read:

Simplified config:

address: :80
plugins:
  - name: logger
  - name: remove-trailing-slash
    redirect_code: 301
hosts:
  dragonpaw.org:
    paths:
      "/":
        plugins:
        - name: static
          root: "/"
          browse: true

Using httpie to test:

$ http http://localhost:80/ Host:dragonpaw.org --verbose
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: dragonpaw.org
User-Agent: HTTPie/0.9.8



HTTP/1.1 404 Not Found
Content-Length: 24
Content-Type: application/json; charset=UTF-8
Date: Sat, 28 Mar 2020 23:47:28 GMT
Server: armor/0.4.14

{
    "message": "Not Found"
}

And the same on the console: {"time":"2020-03-28T23:47:28.977242512Z","id":"","remote_ip":"172.18.0.1","host":"dragonpaw.org","method":"GET","uri":"/","user_agent":"HTTPie/0.9.8","status":404,"error":"code=404, message=Not Found","latency":28600,"latency_human":"28.6µs","bytes_in":0,"bytes_out":24}

The hostname matches what's in the config, and a browseable / shouldn't give a 404, no matter what.

So what am I missing?

dragonpaw avatar Mar 28 '20 23:03 dragonpaw