shisht
(Hello World)
February 6, 2020, 6:14am
1
1. My Caddy version
v2.0.0-beta12 h1:LZnXOGDr1SbeJNyln8Xc/hXjWCa/a9qFpCbWt2iwJPw=
2. How I run Caddy:
using command prompt and Caddyfile
a. System environment:
windows 10
b. Command:
caddy run
c. My complete Caddyfile:
:8080 {
root C:\_Shisht\_Rust\01_Learn\hello-wasm\pkg
file_server browse
header *.wasm Content-Type: application/javascript
}
3. Error messages and/or full log output:
$ caddy.exe run
2020/02/06 06:13:41.836 INFO using adjacent Caddyfile
run: adapting config using : Caddyfile:4: unrecognized directive: header
The header directive was renamed in beta 13. Update to the latest version!
2 Likes
shisht
(Hello World)
February 7, 2020, 2:53am
3
As you said, I updated to latest version and everything is working now
but I want caddy to return custom response header for web-assembly files
and above code is not working
caddy is still returning Content-Type: application/wasm
header
matt
(Matt Holt)
February 7, 2020, 3:34pm
4
Ah, that’s because inlined path matchers must start with a forward slash so they can be identified as a path matcher token.
Since you’re doing a suffix match in your case, simply create a named matcher :
:8080 {
root C:\_Shisht\_Rust\01_Learn\hello-wasm\pkg
file_server browse
@wasm {
path *.wasm
}
header @wasm Content-Type application/javascript
}
Also, note the removal of the colon at the end of the field name. It is not necessary, and adding one will create a header filed called Content-Type:
which is not what you want.
1 Like
shisht
(Hello World)
February 8, 2020, 1:53pm
5
Thanks for reply but
still not working
system
(system)
Closed
May 8, 2020, 1:53pm
6
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.