manni
(Manuel)
April 24, 2017, 7:05pm
1
I have a Dockerised container for Caddy that mounts some static assets, for some reason my rewrite attempts 404:
0.0.0.0:8585
gzip
log stdout
errors stdout
rewrite {
r [a-z]+\.css
to /assets/styles/
}
rewrite {
r [a-z]+\.js
to /assets/scripts/
}
The docker-compose file is like so:
caddy:
image: demo/caddy
ports:
- 8585:8585
volumes:
- ./assets:/assets:ro
- /tmp:/tmp
Bash’ing into the container shows ls -l /assets/scripts
etc do exist.
Can anyone provide some guidance?
tobya
(Toby Allen)
April 24, 2017, 7:17pm
2
try writing to your log using {rewrite_path} this will output what the rewrite engine is rewriting to which may help you diagnose what the issue is.
eg
log / stdout "{remote} {host} {uri} {rewrite_path}"
manni
(Manuel)
April 25, 2017, 8:37am
3
I think it’s because I was using the Golang docker image, Caddy being installed in /go/bin - so setting root /
fixed the issue if I first capture the rewrite rule and passed it on with the placeholder: to /assets/styles/{1}
1 Like
Yeah, I’d think those rewrites wouldn’t work. For example:
rewrite {
r [a-z]+\.js
to /assets/scripts/
}
Would be trying to serve a request to /foo.js
with /assets/scripts/
, which isn’t a file and would 404.
system
(system)
Closed
July 24, 2017, 3:45pm
5
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.