-
Notifications
You must be signed in to change notification settings - Fork 457
Custom Handler Proxying #11035
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
base: dev
Are you sure you want to change the base?
Custom Handler Proxying #11035
Conversation
src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptions.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptionsSetup.cs
Outdated
Show resolved
Hide resolved
_httpProxyService.StartForwarding(scriptInvocationContext, _destinationPrefix); | ||
|
||
await _httpProxyService.EnsureSuccessfulForwardingAsync(scriptInvocationContext); | ||
scriptInvocationContext.ResultSource.SetResult(_successfulInvocationResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the downstream code updates this _successfulInvocationResult
instance? I see we use a shared instance for all invocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the downstream code does not. This value is set to allow the function invocation to continue, but its value is never used (similar to how http proxying flows). We ignore the function invocation result at this step so that the actual response just flows through.
src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptions.cs
Outdated
Show resolved
Hide resolved
6043724
to
a05018b
Compare
}; | ||
|
||
_destinationPrefix = new UriBuilder(WorkerConstants.HttpScheme, WorkerConstants.HostName, _httpWorkerOptions.Port).Uri; | ||
_userAgentString = $"{HttpWorkerConstants.UserAgentHeaderValue}/{ScriptHost.Version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this ever get set outside of the ctor? Could this be a const? It doesnt look like its made up of anything that would require it to be init in here no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't get set outside of the ctor, but ScriptHost.Version
isn't a constant so this can't be init as a constant outside of the ctor at the top of the file.
…zure/azure-functions-host into satvu/custom-handler-streaming
@@ -15,8 +15,16 @@ public class HttpWorkerOptions | |||
|
|||
public int Port { get; set; } | |||
|
|||
/// <summary> | |||
/// Gets or sets a value indicating whether the host will rebuild the initial invocation HTTP Request and send the copy to the worker process. | |||
/// </summary> | |||
public bool EnableForwardingHttpRequest { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit unclear about the property name and the summary comment. From the name, it sounds like the request is simply being forwarded as it is. But the comment suggests that a new copy of the request is being rebuilt from the original and that is sent to the worker process. Should we consider updating the property name to reflect that behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an existing property (see schema store) and we cannot change this without having breaking changes. It's also already documented.
This feature currently works by handling http requests here and calling this extension method.
It's a really unfortunate name - I believe the plan is to phase this setting out in favor of the new one (for streaming). I added the comments to try to make clear the difference between the two very similar property names.
@@ -47,6 +54,9 @@ internal DefaultHttpWorkerService(HttpClient httpClient, IOptions<HttpWorkerOpti | |||
// Set 1 minute greater than FunctionTimeout to ensure invoction failure due to timeout is raised before httpClient raises operation cancelled exception | |||
_httpClient.Timeout = scriptHostOptions.Value.FunctionTimeout.Value.Add(TimeSpan.FromMinutes(1)); | |||
} | |||
|
|||
_destinationPrefix = new UriBuilder(WorkerConstants.HttpScheme, WorkerConstants.HostName, _httpWorkerOptions.Port).Uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a valid scenario where a customer configures their web app to only accept HTTPS traffic, but this code affects request forwarding because it explicitly uses HTTP? Should we allow the customer to specify or override the scheme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue describing the changes in this PR
resolves #11025
Pull request checklist
IMPORTANT: Currently, changes must be backported to the
in-proc
branch to be included in Core Tools and non-Flex deployments.in-proc
branch is not requiredrelease_notes.md