josephspurrier / gowebapp

Basic MVC Web Application in Go
MIT License
1.14k stars 197 forks source link

server.go:2161: http: multiple response.WriteHeader calls #17

Closed ak2344 closed 8 years ago

ak2344 commented 8 years ago

Hi there,

Really appreciate your work. I'm getting weird errors like "server.go:2161: http: multiple response.WriteHeader calls" in my error log after normal looking GET requests to the index page. It's a been a bit hard to debug and replicate.

I know this may be outside the purview of the project, but if you have any pointers on where I can look to track this down, that would be really helpful.

Thanks!

ak2344 commented 8 years ago

Ah never mind, I figured it out. Thanks!

josephspurrier commented 8 years ago

@ak2344 Would you mind sharing what was causing the issue? It may help someone else with the same problem. Also, if you have any more issues, I'd really appreciate you testing with the latest version: https://github.com/blue-jay/blueprint

ak2344 commented 8 years ago

No problem.

I had created my own middleware that checks the URL and forwards the user if it's invalid using http.Redirect(...). The problem was there wasn't a "return" after that so there was further writing to the headers later on.

josephspurrier commented 8 years ago

Ah, I gotcha. Thanks!