twitter-archive / diffy

Find potential bugs in your services with Diffy
https://twitter.com/diffyproject
Apache License 2.0
3.83k stars 368 forks source link

Docker: proxy forwards with the wrong header parameter #96

Closed ZhMi closed 4 years ago

ZhMi commented 4 years ago

Hello, I use the lastest docker which is updated three days ago. Diffy cannot get request result when I used an unresolvable domain name.


I executed the following command. I have configured domain name resolution.

docker run -ti \
  -p 7000:7000 -p 7001:7001 -p 7002:7002 --add-host test.project.com:remote-servier-ip  --add-host develop.project.com:remote-server-ip \
  diffy/diffy \
    -candidate=develop.project.com:80 \
    -master.primary=test.project.com:80 \
    -master.secondary=test.project.com:80 \
    -service.protocol=http \
    -serviceName="Test-Service" \
    -proxy.port=:7000 \
    -admin.port=:7001 \
    -http.port=:7002 \
    -rootUrl=localhost:7002 \
    -summary.email=""
    -summary.delay="5"

The request command is as follows.

curl localhost:7000/api/video/list

But the remote server which is an instance running my code return 404. The nginx error log is as follows

==> tengine.error.log <==
2019/08/30 15:36:52 [error] 1480#0: *287454 open() "/usr/local/matrix/share/tengine/html/video/list" failed (2: No such file or directory), client: request client ip, server: localhost, request: "GET /api/video/list HTTP/1.1", host: "localhost:7000"

The diffy adds the header params(host: "localhost:7000") when it forwards to the remote service. So Nginx could not identify.

Thanks!