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

Fix http endpoint scheme #549

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/tunneldriver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ func (td *TunnelDriver) CreateAgentEndpoint(ctx context.Context, name string, sp
upstreamProto = string(*spec.Upstream.Protocol)
}
opts = append(opts, config.WithAppProtocol(upstreamProto))

// TODO: This should probably be inferred from the scheme in the URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this comment in? If the URL was already parsed using the helper func, then it should already have a scheme, even if the user used one of the shorthand formats.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was meant to comment on the ngrok-go SDK not respecting the scheme in the URL that we give it to remind me to fix it upstream. Open to removing it or modifying it for clarity.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, was just a little confused

if ingressURL.Scheme == "http" {
opts = append(opts, config.WithScheme(config.SchemeHTTP))
}

tunnelConfig = config.HTTPEndpoint(opts...)
case "tls":
opts := []config.TLSEndpointOption{}
Expand All @@ -469,6 +475,7 @@ func (td *TunnelDriver) CreateAgentEndpoint(ctx context.Context, name string, sp
return fmt.Errorf("unsupported protocol for spec.url: %s", ingressURL.Scheme)
}

log.V(1).Info("Adding agent endpoint to ngrok session")
tun, err = session.Listen(ctx, tunnelConfig)
if err != nil {
return err
Expand Down
Loading