1. Caddy version (caddy version
):
windows caddy 2.3.0 and windows latest 2.5.0
2. How I run Caddy:
caddy run --config Caddyfile
a. System environment:
Windows 10 x64
b. Command:
Paste command here.
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
:10000 {
handle /* {
root * ../html/Portal
file_server
try_files {path} {path}/ /index.html?{query}&p={path}
}
handle /api/* {
reverse_proxy http://127.0.0.1:3030
}
handle /Upload/* {
reverse_proxy http://127.0.0.1:3030
}
handle_path /file/* {
reverse_proxy http://127.0.0.1:9000
}
handle /ws {
reverse_proxy http://127.0.0.1:3030
}
# /cloud used by map:40000
handle_path /cloud/* {
reverse_proxy http://127.0.0.1:3030
}
handle_path /2d/* {
header Access-Control-Allow-Credentials true
header Access-Control-Allow-Origin *
root * ../html/CgsMap
file_server
}
handle_path /2d/api/* {
@options {
method OPTIONS
}
handle @options {
header Access-Control-Allow-Origin *
respond @options 204
}
header Access-Control-Allow-Credentials true
header Access-Control-Allow-Headers Auth-Token,Content-Type,Access-Token
rewrite * /api{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /2d/cloud/* {
reverse_proxy http://127.0.0.1:3030
}
handle_path /2d/Upload/* {
header Access-Control-Allow-Headers Auth-Token,Content-Type,Access-Token
rewrite * /Upload{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /3d/* {
header Access-Control-Allow-Credentials true
header Access-Control-Allow-Origin *
root * ../html/CgsJS
file_server
}
handle_path /3d/cloud/* {
reverse_proxy http://127.0.0.1:3030
}
handle_path /3d/api/* {
rewrite * /api{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /3d/Upload/* {
rewrite * /Upload{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /earth/* {
header Access-Control-Allow-Credentials true
header Access-Control-Allow-Origin *
root * ../html/Globe
file_server
}
handle_path /earth/cloud/* {
reverse_proxy http://127.0.0.1:3030
}
handle_path /earth/api/* {
rewrite * /api{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /earth/Upload/* {
rewrite * /Upload{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /bim/* {
root * ../html/Bim
file_server
}
handle_path /bim/api/* {
rewrite * /api{uri}
reverse_proxy http://127.0.0.1:3030
}
handle_path /bim/cloud/* {
reverse_proxy http://127.0.0.1:3030
}
handle_path /form/* {
root * ../html/Form
file_server
try_files {path} /index.html
}
encode zstd gzip
}
3. The problem I’m having:
In the browser, of all handle path, I check js file in debug mode, and got js response header:
Content-Type:text/plain; charset=utf-8 .
(some js file can not run with wrong mimetype)
But other files (css, html) is ok with right Content-type.
And I tried 3 windows 10 PCs, Two of them is OK with text/javascript for js file,
but one PC respond with wrong js Content-Type.
4. Error messages and/or full log output:
5. What I already tried:
1.I update caddy to the newest version for that PC, and still not fixed.
2.I checked chrome version, all of three PCs has the same chrome version.
3.I checked other website(google.com for example) of that pc, and It’s js ContentType is right.