epicagency / caddy-expires Goto Github PK
View Code? Open in Web Editor NEWProvides a directive to add expires headers to certain paths
License: MIT License
Provides a directive to add expires headers to certain paths
License: MIT License
Caddy's import path (and Go module name) has changed from
github.com/mholt/caddy
to
github.com/caddyserver/caddy
Unfortunately, Go modules are not yet mature enough to handle a change like this (see https://golang.org/issue/26904 - "haven't implemented that part yet" but high on priority list for Go 1.14) which caught me off-guard. Using Go module's replace
feature didn't act the way I expected, either. Caddy now fails to build with plugins until they update their import paths.
I've hacked a fix into the build server, so downloading Caddy with your plugin from our website should continue working without any changes on your part, for now. However, please take a moment and update your import paths, and do a new deploy on the website, because the workaround involves ignoring module checksums and performing a delicate recursive search-and-replace.
I'm terribly sorry about this. I did a number of tests and dry-runs to ensure the change would be smooth, but apparently some unknown combination of GOPATH, Go modules' lack of maturity, and other hidden variables in the system or environment must have covered up something I missed.
This bash script should make it easy (run it from your project's top-level directory):
find . -name '*.go' | while read -r f; do
sed -i.bak 's/\/mholt\/caddy/\/caddyserver\/caddy/g' $f && rm $f.bak
done
We use this script in the build server as part of the temporary workaround.
Let me know if you have any questions! Sorry again for the inconvenience.
I tried updating caddy recently, but I had to disable this plugin because it will not work when included together with tls.dns.cloudflare
. It works fine when it is used alone.
You can reproduce the problem from your command line using:
curl "https://caddyserver.com/download/linux/amd64?license=personal&telemetry=off&plugins=http.expires,tls.dns.cloudflare"
provisioning build environment: go mod init: exit status 1
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.
This is noticed on Chrome (Version 54.0.2840.71 (64-bit)) and Firefox (49.0.2) on OS X:
The Expires header itself is not enough to persuade the browser to reload a modified page.
In Safari, seems to work as expected.
(Edit: removed comment regarding Last-Modified - was not correct. Added browser info.)
Hey @hlidotbe - how can I contact you privately? I want to send you instructions to add your plugin to the new build server before it launches in a bit.
Not sure if this is the problem package, but our caddy build has started failing.
starting stage: building caddy
go: downloading github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: downloading github.com/dustin/go-humanize v1.0.0
go: downloading github.com/gorilla/websocket v1.4.0
go: downloading github.com/naoina/toml v0.1.1
go: downloading gopkg.in/yaml.v2 v2.2.2
go: extracting github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: extracting github.com/dustin/go-humanize v1.0.0
go: extracting github.com/naoina/toml v0.1.1
go: extracting github.com/gorilla/websocket v1.4.0
go: downloading github.com/naoina/go-stringutil v0.1.0
go: extracting github.com/naoina/go-stringutil v0.1.0
go: extracting gopkg.in/yaml.v2 v2.2.2
can't load package: package caddy:
expires.go:2:10: invalid import path: ""
error at 'building caddy'
Any ideas? Our dockerfile looks like this
FROM abiosoft/caddy:builder AS caddy
ARG version="1.0.1"
ARG plugins="expires,minify,realip,route53"
ARG enable_telemetry="false"
# process wrapper
RUN go get -v github.com/abiosoft/parent
RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh
(Issue deleted because I had done a mistake and the bug report was invalid.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.