no On Wed, 23 Jun 2021 at 17:11, Alison <alisonc1...@gmail.com> wrote:
> Hi, > > Does anyone have any suggestions about the below ? > > Thank you very much, > > Alison > > > ---------- Forwarded message --------- > From: Alison <alisonc1...@gmail.com> > Date: Fri, 18 Jun 2021, 15:06 > Subject: help websockets > To: <nginx@nginx.org> > > > Hi, > > I'm using the following ingress in my jupyterhub application to expose the > application externally from within the cluster: > > ################ > > apiVersion: networking.k8s.io/v1beta1 > kind: Ingress > metadata: > name: py-ingress > annotations: > kubernetes.io/ingress.class: nginx > nginx.ingress.kubernetes.io/rewrite-target: /jupyterhub$1$2 > namespace: default > spec: > rules: > - http: > paths: > - path: /jupyterhub(/|$)(.*) > backend: > serviceName: jupyterhub > servicePort: 8888 > > > ################# > > When I deploy my application to one kubernetes cluster it works without > problems. > > If I deploy the same application to another kubernetes cluster it fails > (due to http 400 websockets). The part that fails is when I try from the > Jupyter Notebook .... New ->Terminal ... or .... New -> Python3 kernel > > Any idea of what kind of additional annotations I need to add to the above > ingress to solve the websocket issue ? > > > https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/ > > The nginx.conf content looks as follows for the application in both > clusters > > ######################### > > location ~* "^/jupyterhub(/|$)(.*)" { > set $namespace "default"; > set $ingress_name "py-ingress"; > set $service_name ""; > set $service_port ""; > set $location_path "/jupyterhub(/|$(literal_dollar))(.*)"; > > rewrite_by_lua_block { > lua_ingress_rewrite({ > force_ssl_redirect = false, > ssl_redirect = true, > force_no_ssl_redirect = false, > use_port_in_redirects = false, > }) > balancer.rewrite() > plugins.run() > } > > header_filter_by_lua_block { > lua_ingress.header() > plugins.run() > } > > body_filter_by_lua_block { > } > > log_by_lua_block { > balacer.log() > > monitor.call() > > plugins.run() > } > > port_in_redirect off; > > set $balancer_ewma_score -1; > set $proxy_upstream_name "default-jupyterhub-8888"; > set $proxy_host $proxy_upstream_name; > set $pass_access_scheme $scheme; > set $pass_server_port $server_port; > set $best_http_host $http_host; > set $pass_port $pass_server_port; > set $proxy_alternative_upstream_name ""; > client_max_bosy_size 1m; > proxy_set_header Host $best_http_host; > > # Allow websocket connections > > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection $connection_upgrade; > proxy_set_header X-Request-ID $req_id; > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For $remote_addr; > proxy_set_header X-Forwarded-Proto $pass_access_scheme; > proxy_set_header X-Forwarded-Host $best_http_host; > proxy_set_header X-Forwarded-Port $pass_port; > proxy_set_header X-Scheme $pass_access_scheme; > proxy_set_header X-Original-Forwarded-For $http_x_forwarded_for; > proxy_set_header Proxy > proxy_connect_timeout 5s; > proxy_send_timeout 60s; > proxy_buffering off; > proxy_buffer_size 4k; > proxy_buffers 4 4k; > proxy_max_temp_file_size 1024m; > proxy_request_buffering on; > proxy_http_version 1.1; > proxy_cookie_domain off; > proxy_cookie_path off; > proxy_next_upstream error timeout; > proxy_next_upstream_timeout 0; > proxy_next_upstream_tries 3; > > rewrite "(?i)/jupyterhub (/|$)(.*)" /jupyter$1$2 break; > > proxy_pass http://upstream_balancer; > > proxy_redirect off; > > } > > ########################## > > Thank you very much, > > Alison > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx