tilt-dev / tilt-dev/tilt

Add protocol option to port_forward to enable HTTPS services

Open
#6,427 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

Describe the Feature You Want

I would like the ability to specify the protocol handler in port forwards so that links to HTTPS services "just work".

Current Behavior

Navigating to an HTTPS service using a port_forward link results in a 400 Bad Request from nginx.

Our current Tiltfile sets up nginx with a certificate trusted by the user's browser. We have a port-forward clause in our Tiltfile that looks like this:

helm_resource(name='nginx',
              chart='ingress-charts/ingress-nginx',
              labels=['frontend'],
              flags=[...],
              resource_deps=['ingress-charts'],
              port_forwards=[port_forward(8443, 443, name='UI')]

When the user clicks this link, the browser sends an HTTP request, giving a 400 Bad Request ("The plain HTTP request was sent to HTTPS port").

Why Do You Want This?

Users can work around the bad request by manually prepending https:// to the URL in their browser navbar. Users find this tedious, as they must do this every time they click the link. It also creates a decent number of questions as new developers run into this issue.

Adding an option to set the protocol handler in the port_forward would neatly fix this issue. If I could update my port_forward to include protocol='https', then users will no longer need to edit the URL in their browser.

helm_resource(name='nginx',
              chart='ingress-charts/ingress-nginx',
              labels=['frontend'],
              flags=[...],
              resource_deps=['ingress-charts'],
              port_forwards=[port_forward(8443, 443, name='UI', protocol='https')]

Instead of constructing a localhost:8443 link, this would instead construct https://localhost:8443.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the port_forward API and the code that constructs links from its port and name options. Trace how the generated URL is used for existing HTTP forwards, then inspect nearby tests or add coverage for the requested protocol option. Done means HTTPS forwards produce an HTTPS link while existing forwards retain their current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, nginx
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.