1. The problem I’m having:
I’m trying to use the example code from the docs to replicate the 404 behaviour. But cant seem to get it working.
2. Error messages and/or full log output:
curl : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ curl https://www.indrajeethaldar.com/example.html
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebEx
ception
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
3. Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
installed it using the docs - the LTS version here Install — Caddy Documentation.
a. System environment:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
b. Command:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
c. Service/unit/compose file:
curl https://www.indrajeethaldar.com/example.html
The above html page does not exist
also started the caddy system with
sudo caddy start --config Caddyfile
d. My complete Caddy config:
indrajeethaldar.com {
redir https://www.indrajeethaldar.com{uri}
}
www.indrajeethaldar.com {
root * /home/indrajeet/portfolio
file_server
}
handle_errors {
rewrite * /{err.status_code}
reverse_proxy https://http.cat {
header_up Host {upstream_hostport}
replace_status {err.status_code}
}
}
5. Links to relevant resources:
Tried using this example handle_errors (Caddyfile directive) — Caddy Documentation