-
Notifications
You must be signed in to change notification settings - Fork 3
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mime type matching instead of regexes #5
Comments
Rewrote the matching rules to support header matching in addition to path matching.
Hi, took long enough but I finally took some time to implement it. |
Is this already available if I update caddy or do I need to wait for a new release? |
It's released on caddyserver.com. I forgot to do the release on github but caddy should use the latest version. |
Alright, I tried it but I can't tell how to configure it then. match_header content-type text/(css|js)(;.*)? 30d
match_header content-type text\/css 30d
match_header content-type .*text\/css.* 30d
match_header content-type .*text/css.* 30d this does work though match_header content-type .* 30d |
The raw content type I'm seeing in my browser is |
ok so the Could you test with Content-Type ? Maybe your browser normalize to lower case but usually it's capitalized. The / should not need escaping and just |
According to the doc, headers are case insensitive, I tried, as expected, it didn't change anything. I tested for static files, have not tried it through a proxied connection just yet, if it helps, I can test that later. |
Finally had a look into that issue. Unfortunately I don't have good news. While the logic is ok, technically I can't handle headers on static content because Caddy defer to net/http ServeContent then terminate. Nothing happens after the file is served. match_header will work on anything not static but the only header available for static files is "Server". I'll have a look at the v2 to see if there's a way to overcome this. |
Some web applications don't always have an extension, I'd like to set expiration header based on the mime type of the query instead of the path.
What would be really awesome is to allow checking any available placeholder (kind of like the rewrite the http.rewrite plugin), but I'm guessing that's much more complex.
The text was updated successfully, but these errors were encountered: