Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Handle redirects (HTTP/307) #9

Open
harmw opened this issue Mar 5, 2018 · 0 comments
Open

Handle redirects (HTTP/307) #9

harmw opened this issue Mar 5, 2018 · 0 comments

Comments

@harmw
Copy link
Contributor

harmw commented Mar 5, 2018

The following can be observed on a regular Mesos cluster, when we try to launch vamp-gateway-agent:

2018/03/05 12:10:26.283428 run.go:124: WORKFLOW - HTTP REQUEST [0] {"protocol":"http:","port":"5050","hostname":"mesos-master.service.consul","method":"GET","headers":{},"path":"/master/slaves"}
2018/03/05 12:10:26.297016 run.go:124: WORKFLOW - HTTP RESPONSE [0] 307
2018/03/05 12:10:26.297665 run.go:122: ERROR -  WORKFLOW - events.js:160
2018/03/05 12:10:26.297687 run.go:122: ERROR -  WORKFLOW -       throw er; // Unhandled 'error' event
2018/03/05 12:10:26.297695 run.go:122: ERROR -  WORKFLOW -       ^
2018/03/05 12:10:26.297705 run.go:122: ERROR -  WORKFLOW - 
2018/03/05 12:10:26.297716 run.go:122: ERROR -  WORKFLOW - Error: [307]: 
2018/03/05 12:10:26.297736 run.go:122: ERROR -  WORKFLOW -     at IncomingMessage.response.on (/usr/local/vamp/node_modules/vamp-node-client/http.js:38:22)
2018/03/05 12:10:26.297743 run.go:122: ERROR -  WORKFLOW -     at emitNone (events.js:91:20)
2018/03/05 12:10:26.297760 run.go:122: ERROR -  WORKFLOW -     at IncomingMessage.emit (events.js:185:7)
2018/03/05 12:10:26.297767 run.go:122: ERROR -  WORKFLOW -     at endReadableNT (_stream_readable.js:974:12)
2018/03/05 12:10:26.297779 run.go:122: ERROR -  WORKFLOW -     at _combinedTickCallback (internal/process/next_tick.js:74:11)
2018/03/05 12:10:26.297786 run.go:122: ERROR -  WORKFLOW -     at process._tickCallback (internal/process/next_tick.js:98:9)

This happens because we are trying our request against any Mesos-master machine in the cluster. Mesos will happily acknowledge this request with a redirect to the current-cluster-leader. Vamp is just not wired to follow that, given that it only looks for answers in the range of HTTP/200-299.

Dumbing it down to just a simple curl:

/ # curl -I 10.204.104.49:5050/master/slaves
HTTP/1.1 307 Temporary Redirect
Date: Mon, 05 Mar 2018 12:16:18 GMT
Location: //mesos-master-i-0b08fddeaa8778de9.play.ground.dev.blaze.ps:5050/master/slaves
Content-Length: 0

Ideally, should this (specifically 307) be seen we should probably be following the Location header.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant