caddyserver / forwardproxy

Forward proxy plugin for the Caddy web server
Apache License 2.0
582 stars 218 forks source link

"308 Permanent Redirect" #92

Closed DUOLabs333 closed 2 years ago

DUOLabs333 commented 2 years ago

1. Is bug reproducible with latest forwardproxy build?

Yest

2. What are you trying to do?

I set up my proxy and tried to do curl -x http://proxy.history.test:80 http://neverssl.com:80, but all I got was a HTTP/1.1 308 Permanent Redirect/

3. What is your entire Caddyfile?

{
http_port 80
https_port 443
admin off
}
(snippet) {
{args.0}.test {
tls /home/system/Services/nginx/data/cert.pem /home/system/Services/nginx/data/key.pem
reverse_proxy   localhost:{args.1}
}
}

import snippet whoogle 2001
import snippet adguard 2002
#import snippet proxy.history 2011

http://proxy.history.test 
{
route {
forward_proxy {
}
}
}

4. How is your client configured?

I just use curl.

5. How did you run Caddy? (give the full command and describe the execution environment). If multiple servers are used (for example with upstream), describe those as well.

`./caddy run -config Caddyfile

6. Please paste any relevant HTTP request(s) here.

7. What did you expect to see?

The same result as curl http://neverssl.com:80

8. What did you see instead (give full error messages and/or log)?

*   Trying 10.200.200.1:80...
* Connected to proxy.history.test (10.200.200.1) port 80 (#0)
> GET http://neverssl.com/ HTTP/1.1
> Host: neverssl.com
> User-Agent: curl/7.81.0
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://neverssl.com/
< Server: Caddy
< Date: Mon, 21 Mar 2022 15:23:55 GMT
< Content-Length: 0
< 
* Closing connection 0

9. How can someone who is starting from scratch reproduce the bug as minimally as possible?

Compile caddy with this plugin, set your DNS to resolve *.test to localhost, make a Caddyfile with the above text, and start it.

mholt commented 2 years ago

Did you mean to close this?

DUOLabs333 commented 2 years ago

Yes