Skip to content

ReverseProxyPlugin doesn't return a response to the client #1433

Closed
@eaftan

Description

@eaftan

Check FAQs
Please check Frequently Asked Questions
before opening a bug report.

Describe the bug

The included example ReverseProxyPlugin doesn't seem to work. It doesn't return any response to the client.

To Reproduce
Steps to reproduce the behavior:

  1. In one terminal, run the following command: proxy --enable-reverse-proxy --plugins proxy.plugin.ReverseProxyPlugin
  2. In another terminal, run this command to send a request: curl -v localhost:8899/get
  3. The curl command never gets a response; it reports "Empty reply from server"

Here are the outputs I see on my machine when I do this.

Proxy

% proxy --enable-reverse-proxy --plugins proxy.plugin.ReverseProxyPlugin
2024-07-23 14:02:31,090 - pid:2514 [I] plugins.load:89 - Loaded plugin proxy.http.proxy.HttpProxyPlugin
2024-07-23 14:02:31,091 - pid:2514 [I] plugins.load:89 - Loaded plugin proxy.http.server.HttpWebServerPlugin
2024-07-23 14:02:31,094 - pid:2514 [I] plugins.load:89 - Loaded plugin proxy.http.server.reverse.ReverseProxy
2024-07-23 14:02:31,094 - pid:2514 [I] plugins.load:89 - Loaded plugin proxy.plugin.ReverseProxyPlugin
2024-07-23 14:02:43,471 - pid:2519 [I] reverse.on_access_log:168 - 127.0.0.1:65505 - GET /get - curl/8.6.0 -> None - 10198.24ms

Curl

% curl -v localhost:8899/get
* Host localhost:8899 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:8899...
* connect to ::1 port 8899 from ::1 port 65504 failed: Connection refused
*   Trying 127.0.0.1:8899...
* Connected to localhost (127.0.0.1) port 8899
> GET /get HTTP/1.1
> Host: localhost:8899
> User-Agent: curl/8.6.0
> Accept: */*
> 
* Empty reply from server
* Closing connection
curl: (52) Empty reply from server

Expected behavior
I expect the output that httpbin.org/get returns:

{
  "args": {}, 
  "headers": {
    "Accept": "*/*", 
    "Host": "httpbin.org", 
    "User-Agent": "curl/8.6.0", 
    "X-Amzn-Trace-Id": "Root=1-66a01aff-7ebaa35e304be47c40746c5b"
  }, 
  "origin": "24.7.24.238", 
  "url": "http://httpbin.org/get"
}

Version information
I see this behavior on two different machines.

  • OS: MacOS 14.5 and Ubuntu Linux 20.04.1
  • Browser: N/A
  • Device: M1 Macbook Pro, an Azure VM for Ubuntu
  • proxy.py Version: 2.4.5.dev9+ga7077cf

Additional context
Add any other context about the problem here.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

Labels

BugBug report in proxy server

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions