Skip to content

Fix error when using upstream for HTTP request#191

Open
ImpostorKeanu wants to merge 1 commit intocaddyserver:masterfrom
ImpostorKeanu:fix-http-upstream
Open

Fix error when using upstream for HTTP request#191
ImpostorKeanu wants to merge 1 commit intocaddyserver:masterfrom
ImpostorKeanu:fix-http-upstream

Conversation

@ImpostorKeanu
Copy link

1. What does this change do, exactly?

This change properly scopes an error value.

Without scoping the error, any request with a Host header value that doesn't have a port will result in a bad gateway response when the handler is configured with an upstream.

This is because the error is shadowed at this point during execution.

Here's an example route configuration that would error out:

- handler: forward_proxy
  upstream: http://my.proxy.com

Here's a command that would induce an error:

# assumes server listens on localhost 20000
curl -vv -x http://127.0.0.1:20000 http://ifconfig.io

2. Please link to the relevant issues.

N/A

3. Which documentation changes (if any) need to be made because of this PR?

N/A

4. Checklist

  • I have written tests and verified that they fail without my change
  • I made pull request as minimal and simple as possible. If change is not small or additional dependencies are required, I opened an issue to propose and discuss the design first
  • I have squashed any insignificant commits
  • This change has comments for package types, values, functions, and non-obvious lines of code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant