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

HTTP probe paths are urlencoded when requests reach containers #14357

Closed
emaildanwilson opened this issue Sep 12, 2023 · 2 comments
Closed

HTTP probe paths are urlencoded when requests reach containers #14357

emaildanwilson opened this issue Sep 12, 2023 · 2 comments
Labels
area/API API objects and controllers kind/bug Categorizes issue or PR as related to a bug.

Comments

@emaildanwilson
Copy link
Contributor

emaildanwilson commented Sep 12, 2023

/area API

What version of Knative?

any version
0.11.x

Expected Behavior

If an http probe is defined with a path containing query parameters, the request should reach the workload as it is defined just like it does on a Kubernetes pod.

for example:

path: /?type=healthcheck
port: 8080

should reach the container as http://:8080/?type=healthcheck

Actual Behavior

instead it reaches the container as http://:8080/%3Ftype%3Dhealthcheck

Steps to Reproduce the Problem

This ksvc fails the health probe because httpbin does not url decode before matching the route.
The GUNICORN_CMD_ARGS environment variable configures logging of requests so it's easy to see what queue-proxy is sending to the container.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: httpbin
  namespace: default
spec:
  template:
    metadata:
    spec:
      containers:
      - env:
        - name: GUNICORN_CMD_ARGS
          value: '--capture-output --error-logfile - --access-logfile - --access-logformat
            ''%(h)s %(t)s %(r)s %(s)s Host: %({Host}i)s}'''
        image: kennethreitz/httpbin
        name: httpbin
        ports:
        - containerPort: 80
          name: http1
        readinessProbe:
          failureThreshold: 5
          httpGet:
            path: /headers?p1=123&p2=456
            port: 80
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1

I believe this is because the probe is created from url.String() which uses url.EscapedPath().

@emaildanwilson emaildanwilson added the kind/bug Categorizes issue or PR as related to a bug. label Sep 12, 2023
@knative-prow knative-prow bot added the area/API API objects and controllers label Sep 12, 2023
@nak3
Copy link
Contributor

nak3 commented Sep 13, 2023

Thank you for your report! This bug should be fixed in the next release v1.12 via #14267

@nak3
Copy link
Contributor

nak3 commented Sep 14, 2023

Closing as dup of #14267

@nak3 nak3 closed this as completed Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API API objects and controllers kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants