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

Service broker client does not handle redirects #1893

Closed
tcdowney opened this issue Oct 9, 2020 · 2 comments
Closed

Service broker client does not handle redirects #1893

tcdowney opened this issue Oct 9, 2020 · 2 comments
Labels

Comments

@tcdowney
Copy link
Member

tcdowney commented Oct 9, 2020

Issue

The service broker client in Cloud Controller does not appear to follow redirects (e.g. 301).

We've observed this in environments where http is redirected to https, as is the case for service brokers that are deployed as apps on cf-for-k8s where this redirection is configured by default.

Context

Brought to us via Slack by @reneighbor, this is resulting in failing CATS :
https://cloudfoundry.slack.com/archives/C017LDM6KTQ/p1602280933144500

Steps to Reproduce

The test makes a request like this:

POST /v3/service_brokers HTTP/1.1
Host: api.approachable-mimicker.k8s-dev.relint.rocks
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: cf/7.1.0+4c3168f9a.2020-09-09 (go1.13.8; amd64 darwin)
{
  "authentication": {
    "credentials": {
      "password": "[PRIVATE DATA HIDDEN]",
      "username": "username"
    },
    "type": "basic"
  },
  "name": "CATS-1-BRKR-9fff84a541fc6c28",
  "url": "http://CATS-1-BRKR-9fff84a541fc6c28.approachable-mimicker.k8s-dev.relint.rocks"
}

And the asynchronous job eventually fails with an error like this:

The service broker returned an invalid response. Status Code: 301 Moved Permanently, Body

Expected result

I would expect the service broker client to follow the redirect.

Current result

The service broker client does not follow the redirect and considers the 301 to be the final response.

Possible Fix

Figure out why the client isn't following the redirect and see if you can make it do so. If this is impossible we can probably have the code check for redirect level status codes and manually remake the request to the correct endpoint as specified by the Location response header.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/175213685

The labels on this github issue will be updated when the story is started.

@blgm
Copy link
Member

blgm commented Oct 14, 2020

Fixed by #1896

@blgm blgm closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants