Open kgartland-rstudio opened 1 month ago
Let's take another look to see if this is still happening. Once we determine what is going on we can decide if we want to keep this in 1.6.0
or not.
This is still occurring, removing the retest tag.
Looking at the code path for credential verification we could detect 300-399
redirection response codes and use the URL we get redirected to as the server URL to solve this issue. I'll do a bit more digging to see how much work that would entail.
After some investigation I learned that a redirect from http
to https
is causing the request method to get swapped from POST
to GET
which explains the json: cannot unmarshal array into Go value of type connect.connectGetContentDTO
.
MDN's documentation around Permanent redirections mentions that 301 Moved Permanently
can possibly swap methods to GET
, where 308 Permanent Redirect
the "Method and body not changed".
Go's HTTP Client tries to follow the redirects, but with the swap the un-marshaling errors since what we get back is an array of content.
The potential solutions are:
308 Permanent Redirect
which may or may not be Connect's responsibility. It very well could be something that is setup by users when configuring a Connect installationWould another option be that during credential creation, if we are provided with a server address that contains the protocol of http:
, we test ourselves if a secure connection is and then use it? We're already testing the server URL and possibly using only part of it, so it wouldn't be that far out from what we're doing now.
This being said... I think I prefer to follow the redirect and simply record the final URL as part of the credential.
Would another option be that during credential creation, if we are provided with a server address that contains the protocol of
http:
, we test ourselves if a secure connection is and then use it?
I'll update the title of this issue, but I think the key here is using a URL that redirects to another rather than anything to do with http
or https
.
I'll update the title of this issue, but I think the key here is using a URL that redirects to another rather than anything to do with http or https.
Thanks for digging into this + refining the issue 💯
You can add the dogfood server credentials using the
http://
protocol successfully. When you deploy using those credentials the following error is thrown:Error from the Output logs:
Ideally we wouldn't allow http to be used for a secure server but can we also throw a more human-readable error here?