Skip to content

Fix rewritten links by Kubernetes when after using the proxy endpoint

What does this MR do?

When we proxy HTTP requests to the runner and they go through the Kubernetes proxy endpoint, any relative url set in the response is automatically updated by Kubernetes as: /api/v1/namespace/default/service/http:whatever:80/proxy/foo.html.

This scenario works when we are using kubectl proxy but, when we are sending this response to the user, those urls don't work.

In this MR we remove that url prefix.

Moreover, because of how the Kubernetes proxy endpoint works, the response we get from the proxied server is just the body either as a stream or []byte. This approach doesn't work either because we need the headers sent by the server.

At least, as a small iteration, we're setting the Content-Type header based on the page requested.

Why was this MR needed?

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

Merge request reports