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

Offloaded HTTPS: Redirect HTTP port traffic to HTTPS #1811

Closed
Show file tree
Hide file tree
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: 6 additions & 1 deletion jupyterhub/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- $manualHTTPS := and .Values.proxy.https.enabled (eq .Values.proxy.https.type "manual") -}}
{{- $manualHTTPSwithsecret := and .Values.proxy.https.enabled (eq .Values.proxy.https.type "secret") -}}
{{- $offloadHTTPS := and .Values.proxy.https.enabled (eq .Values.proxy.https.type "offload") -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -70,6 +71,10 @@ spec:
- --redirect-to=443
- --ssl-key=/etc/chp/tls/{{ .Values.proxy.https.secret.key }}
- --ssl-cert=/etc/chp/tls/{{ .Values.proxy.https.secret.crt }}
{{- else if $offloadHTTPS }}
- --port=8443
- --redirect-port=8000
- --redirect-to=443
Copy link
Member Author

@consideRatio consideRatio Oct 6, 2020

Choose a reason for hiding this comment

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

What flags should be used here? I figure the goal is really to send back a redirect with a Location header (where someone is redirected) being the same as the request originally but with a https:// scheme.

Flags at our disposal according to the CHP readme

  --redirect-port <redirect-port>    Redirect HTTP requests on this port to the server on HTTPS
  --redirect-to <port>               Redirect HTTP requests from --redirect-port to this port
  --auto-rewrite                     Rewrite the Location header host/port in redirect responses
  --protocol-rewrite <proto>         Rewrite the Location header protocol in redirect responses to the specified protocol

{{- else }}
- --port=8000
{{- end }}
Expand Down Expand Up @@ -103,7 +108,7 @@ spec:
imagePullPolicy: {{ . }}
{{- end }}
ports:
{{- if or $manualHTTPS $manualHTTPSwithsecret }}
{{- if or (or $manualHTTPS $manualHTTPSwithsecret) $offloadHTTPS }}
- name: https
containerPort: 8443
{{- end }}
Expand Down
7 changes: 0 additions & 7 deletions jupyterhub/templates/proxy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ spec:
{{- if $HTTPS }}
- name: https
port: 443
# When HTTPS termination is handled outside our helm chart, pass traffic
# coming in via this Service's port 443 to targeted pod's port meant for
# HTTP traffic.
{{- if $offloadHTTPS }}
targetPort: http
{{- else }}
targetPort: https
{{- end }}
{{- with .Values.proxy.service.nodePorts.https }}
nodePort: {{ . }}
{{- end }}
Expand Down