Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not supporting proxy mode #1576

Closed
qcastel opened this issue Feb 21, 2020 · 2 comments
Closed

Not supporting proxy mode #1576

qcastel opened this issue Feb 21, 2020 · 2 comments

Comments

@qcastel
Copy link

qcastel commented Feb 21, 2020

Describe the bug
When trying to proxy requests through Spring cloud gateway:

curl -k --proxy https://local-api.yapily.com:8080  https://httpbin.org/get

the response is:

curl: (56) Received HTTP code 404 from proxy after CONNECT

However:

curl -k  https://local-api.yapily.com:8080/get --header 'host: httpbin.org'

works fine:

{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Content-Length": "0",
    "Forwarded": "proto=https;host=httpbin.org;for=\"127.0.0.1:56283\"",
    "Host": "httpbin.org",
    "User-Agent": "curl/7.64.1",
    "X-Amzn-Trace-Id": "Root=1-5e4ffd2a-7502421dd2e64f1145125dc3",
    "X-Forwarded-Host": "httpbin.org"
  },
  "origin": "127.0.0.1, 35.189.96.6",
  "url": "https://httpbin.org/get"
}

Sample
I reproduce the issue here:
https://github.com/qcastel/reproduce-spring-cloud-gateway-error

Please note that I use the latest netty snapshot, as they were an NPE on netty that is now solved by reactor/reactor-netty#948

@GuyLewin
Copy link
Contributor

Is it supposed to work to begin with? I believe Spring Cloud Gateway is a reverse proxy that isn't supposed to act as a forward proxy with HTTP CONNECT protocol. Please correct me if I'm wrong.

In order to implement it you can extend WebServerFactoryCustomizer<NettyReactiveWebServerFactory> to change the Netty pipeline, to accept HTTP CONNECT requests.

@spencergibb
Copy link
Member

Correct, gateway is a reverse proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants