Detects cache headers and runs the appropriate function.
Added support for setting content-encoding
Add json mime type override