gzip icon indicating copy to clipboard operation
gzip copied to clipboard

Gzip on error does not show error page

Open leebrooks0 opened this issue 12 years ago • 9 comments

If there is a server side error GZip returns a file to the browser named latest, and does not display an error in the browser. If you turn Gzip off then you get an error page in the browser which makes debugging a lot easier than having to switch back to the terminal

leebrooks0 avatar Feb 11 '14 08:02 leebrooks0

Do you have any example code that recreates the issue that I could look at?

slogsdon avatar Feb 11 '14 13:02 slogsdon

Will make up an example later to try and replicate this, although so far panic(err) from anywhere seems to do the trick with me.

On Tue, Feb 11, 2014 at 3:30 PM, Shane Logsdon [email protected]:

Do you have any example code that recreates the issue that I could look at?

Reply to this email directly or view it on GitHubhttps://github.com/martini-contrib/gzip/issues/2#issuecomment-34753897 .

leebrooks0 avatar Feb 11 '14 13:02 leebrooks0

@slogsdon this snippet replicates the issue for me.

package main

import (
    "github.com/codegangsta/martini"
    "github.com/martini-contrib/gzip"
)

func main() {
    m := martini.Classic()
    m.Use(gzip.All())
    m.Get("/", func() string {
        panic("Oh noes!")
        return "Hello world!"
    })
    m.Run()
}

leebrooks0 avatar Feb 12 '14 09:02 leebrooks0

@leebrooks0 Thanks for this. It will help in troubleshooting your issues.

slogsdon avatar Feb 12 '14 15:02 slogsdon

This is an interesting problem. It makes me wonder if it would make more sense for the recovery middleware to get the responsewriter after context.Next() is called. That way the error html can still pass through gzipped

codegangsta avatar Feb 12 '14 19:02 codegangsta

@codegangsta From looking at this, what you're describing should correct the issue. I still need to verify that's true, however.

slogsdon avatar Feb 13 '14 18:02 slogsdon

Cool. I can look into testing this out sometime this week. Otherwise if one if you want to take a crack at it you are more than welcome to :)

codegangsta avatar Feb 13 '14 19:02 codegangsta

I went ahead and fixed this in martini core.

https://github.com/codegangsta/martini/commit/06dc3e9688c52f273f9cd8cd833e08b50e49b677

Please confirm that it works on your end

codegangsta avatar Feb 22 '14 19:02 codegangsta

Oops sorry been busy with other stuff - will get onto it soon

leebrooks0 avatar Mar 02 '14 01:03 leebrooks0