1. The problem I’m having:
I want to Reverse Proxy from this site : https://new.uservideo.xyz but it keep redirecting to proxy source (https://new.uservideo.xyz).
2. Error messages and/or full log output:
when i tried to access :8081 it redirected to source proxy
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET / HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Cf-Cache-Status: DYNAMIC
< Cf-Ray: 7f70f384a8ae4c23-SIN
< Content-Type: text/html; charset=UTF-8
< Date: Tue, 15 Aug 2023 11:03:29 GMT
< Location: https://new.uservideo.xyz/
< Nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< Portzilla-Error: false
< Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=mRjWpK%2BybJJKT5lD6u9K7GBUoLGTLhytjUAGCd4mHFHC9KBhKWH%2FkJkayU0gapXXR0XgPa8%2BRum0vcx0EqnFUg3CCP3%2BBR7baLOSRrypT0HoMOWEyKMs4u2miQQfmsVYl6fuvPO3bQg%3D"}],"group":"cf-nel","max_age":604800}
< Server: Caddy
< Server: cloudflare
< Vary: Accept-Encoding
< X-Litespeed-Cache: miss
< X-Litespeed-Cache-Control: public,max-age=604800
< X-Litespeed-Tag: 30f_HTTP.200,30f_HTTP.301,30f_home,30f_URL.6666cd76f96956469e7be39d750cc7d9,30f_F,30f_
< X-Redirect-By: WordPress
< Content-Length: 0
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Connection #0 to host localhost left intact
Here is debug log form caddy
{"level":"info","ts":1692097384.7690356,"msg":"using provided configuration","config_file":"./Caddyfile","config_adapter":""}
{"level":"warn","ts":1692097384.7923717,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"./Caddyfile","line":3}
{"level":"info","ts":1692097384.8111749,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1692097384.8138287,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0006d8880"}
{"level":"debug","ts":1692097384.8160114,"logger":"http.auto_https","msg":"adjusted config","tls":{"automation":{"policies":[{}]}},"http":{"servers":{"srv0":{"listen":[":8081"],"routes":[{"handle":[{"handler":"reverse_proxy","headers":{"request":{"set":{"Accept-Encoding":["identity"],"Host":["{http.reverse_proxy.upstream.hostport}"]}}},"transport":{"protocol":"http","tls":{}},"upstreams":[{"dial":"new.uservideo.xyz:443"}]}]}],"automatic_https":{}}}}}
{"level":"info","ts":1692097384.8527768,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:C:\\Users\\U53R\\AppData\\Roaming\\Caddy"}
{"level":"info","ts":1692097384.8538337,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"debug","ts":1692097384.8538337,"logger":"http","msg":"starting server loop","address":"[::]:8081","tls":false,"http3":false}
{"level":"info","ts":1692097384.8555703,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1692097384.8566542,"msg":"autosaved config (load with --resume flag)","file":"C:\\Users\\U53R\\AppData\\Roaming\\Caddy\\autosave.json"}
{"level":"info","ts":1692097384.8566542,"msg":"serving initial configuration"}
{"level":"debug","ts":1692097408.6855216,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"new.uservideo.xyz:443","total_upstreams":1}
{"level":"debug","ts":1692097409.388124,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"new.uservideo.xyz:443","duration":0.6969309,"request":{"remote_ip":"127.0.0.1","remote_port":"55133","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"new.uservideo.xyz:443","uri":"/","headers":{"Accept-Encoding":["identity"],"User-Agent":["curl/7.88.1"],"Accept":["*/*"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Proto":["http"],"X-Forwarded-Host":["localhost:8081"]}},"headers":{"X-Redirect-By":["WordPress"],"Nel":["{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}"],"Location":["https://new.uservideo.xyz/"],"Cf-Cache-Status":["DYNAMIC"],"X-Litespeed-Cache":["miss"],"X-Litespeed-Cache-Control":["public,max-age=604800"],"Date":["Tue, 15 Aug 2023 11:03:29 GMT"],"Cf-Ray":["7f70f384a8ae4c23-SIN"],"X-Litespeed-Tag":["30f_HTTP.200,30f_HTTP.301,30f_home,30f_URL.6666cd76f96956469e7be39d750cc7d9,30f_F,30f_"],"Report-To":["{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=mRjWpK%2BybJJKT5lD6u9K7GBUoLGTLhytjUAGCd4mHFHC9KBhKWH%2FkJkayU0gapXXR0XgPa8%2BRum0vcx0EqnFUg3CCP3%2BBR7baLOSRrypT0HoMOWEyKMs4u2miQQfmsVYl6fuvPO3bQg%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}"],"Content-Type":["text/html; charset=UTF-8"],"Alt-Svc":["h3=\":443\"; ma=86400"],"Portzilla-Error":["false"],"Vary":["Accept-Encoding"],"Server":["cloudflare"]},"status":301}
3. Caddy version:
v2.7.3 h1:eMCNjOyMgB5A1KgOzT2dXKR4I0Va+YHCJYC8HHu+DP0=
4. How I installed and ran Caddy:
i downloaded windows binary from Download Caddy
a. System environment:
Windows
b. Command:
./caddy.exe run --config ./Caddyfile
c. Service/unit/compose file:
d. My complete Caddy config:
{
order replace after encode
}
:8081 {
reverse_proxy * https://new.uservideo.xyz {
header_up Host {upstream_hostport}
header_up Accept-Encoding identity
}
}