Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/apwlq/caddy-minify

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/apwlq/caddy-minify

  • v0.2.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

File (html/css/js/etc..) minification module for Caddy v2

powered by tdewolff/minify & inspired by hacdias/caddy-v1-minify

Caddy module ID

http.handlers.minify

Support formats

  • html: text/html
  • css: text/css
  • svg: image/svg+xml
  • js: ^(application|text)/(x-)?(java|ecma)script$
  • json: [/+]json$
  • xml: [/+]xml$

Performance

See https://github.com/tdewolff/minify#performance

How to use

Make sure to order the handler in the correct place:

{
    order minify after encode
}

With file_server:

example.com {
    minify
    root ./test
    file_server     
}

or reverse_proxy:

example.com {
    minify
    reverse_proxy localhost:8080
}

limit formats (format all when not specified.):

example.com {
    minify {
        formats html css js
    }
    
    reverse_proxy
}

or simply:

example.com {
    minify html css js
    reverse_proxy localhost:8080
}

Limitations

This module doesn't minify the original responses that have already been compressed, It just skips them.

To work around this, you may send the Accept-Encoding: identity request header to the upstream to tell it not to compress the response. For example:

reverse_proxy localhost:8080 {
    header_up Accept-Encoding identity
}

FAQs

Package last updated on 03 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc