cloudfoundry-samples / lattice-app

A Demo Application for Lattice
Apache License 2.0
6 stars 22 forks source link

Add /port endpoint to echo the incoming port #9

Closed wendorf closed 8 years ago

wendorf commented 8 years ago

This is useful for testing TCP/HTTP port routing, to verify that the correct incoming port is being used.

[#107248522]

cf-gitbot commented 8 years ago

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/108648246.

davidwadden commented 8 years ago

Not sure why, this endpoint is failing when pushed to CF:

2015-12-11T16:38:39.48-0600 [APP/0]      OUT {"timestamp":"1449873519.488920927","source":"lattice-app","message":"lattice-app.PORT.request.begin","log_level":0,"data":{"session":"1"}}
2015-12-11T16:38:39.49-0600 [APP/0]      ERR 2015/12/11 22:38:39 http: panic serving 192.168.33.33:37860: runtime error: index out of range
2015-12-11T16:38:39.49-0600 [APP/0]      ERR goroutine 14 [running]:
2015-12-11T16:38:39.49-0600 [APP/0]      ERR net/http.func·011()
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /usr/local/go/src/net/http/server.go:1130 +0xbb
2015-12-11T16:38:39.49-0600 [APP/0]      ERR github.com/cloudfoundry-samples/lattice-app/handlers.(*Port).ServeHTTP(0x8b98b8, 0x7f9754a324a8, 0xc20803c320, 0xc2080328f0)
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /tmp/app/.heroku/go/src/github.com/cloudfoundry-samples/lattice-app/handlers/port.go:13 +0x1d2
2015-12-11T16:38:39.49-0600 [APP/0]      ERR github.com/cloudfoundry-samples/lattice-app/handlers.(*LoggingHandler).ServeHTTP(0xc20803b0b0, 0x7f9754a324a8, 0xc20803c320, 0xc2080328f0)
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /tmp/app/.heroku/go/src/github.com/cloudfoundry-samples/lattice-app/handlers/handlers.go:42 +0x115
2015-12-11T16:38:39.49-0600 [APP/0]      ERR github.com/bmizerany/pat.(*PatternServeMux).ServeHTTP(0xc20802c098, 0x7f9754a324a8, 0xc20803c320, 0xc2080328f0)
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /tmp/app/.heroku/go/src/github.com/cloudfoundry-samples/lattice-app/Godeps/_workspace/src/github.com/bmizerany/pat/mux.go:109 +0x21c
2015-12-11T16:38:39.49-0600 [APP/0]      ERR net/http.serverHandler.ServeHTTP(0xc20805c3c0, 0x7f9754a324a8, 0xc20803c320, 0xc2080328f0)
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /usr/local/go/src/net/http/server.go:1703 +0x19a
2015-12-11T16:38:39.49-0600 [APP/0]      ERR net/http.(*conn).serve(0xc20803c280)
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /usr/local/go/src/net/http/server.go:1204 +0xb57
2015-12-11T16:38:39.49-0600 [APP/0]      ERR created by net/http.(*Server).Serve
2015-12-11T16:38:39.49-0600 [APP/0]      ERR    /usr/local/go/src/net/http/server.go:1751 +0x35e
2015-12-11T16:38:39.49-0600 [RTR/0]      OUT app.3.micropcf.io - [11/12/2015:22:38:39 +0000] "GET /port HTTP/1.1" 502 0 67 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36" 192.168.33.1:65267 x_forwarded_for:"-" x_forwarded_proto:"-" vcap_request_id:b3883faa-ef52-4d40-6e21-b0b7dd9507dd response_time:0.002193948 app_id:a40cee58-ca32-498e-b4f3-33cfa562f76c
shalako commented 8 years ago

This would be really useful, as we use this app for testing support for multiple ports.