Host blocks don't appear to work?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.7k
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the simplified YAML configuration in a Docker container and the HTTPie request using Host: dragonpaw.org. Trace how the hosts and paths configuration is read and matched, then verify that the browseable root serves content instead of returning 404.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100