Skip to content

Commit 441bff5

Browse files
feat: support http coder urls (#217)
Currently, in the Login Form, we reject non-https URLs. When this HTTPS requirement was added, the Coder Desktop app was unable to make HTTP requests, as it did not have `NSArbitraryLoads`. We ended up needing to enable that flag in order to use the Agent API. (`http://workspace.coder:4`) To support Coder deployments behind VPNs without HTTPS, we can now loosen the requirement. With this PR, the behavior [matches Windows.](https://github.com/coder/coder-desktop-windows/blob/ac22fe4c44dea03b21557b4a0f1e214397bc3ea4/App/Services/CredentialManager.cs#L175-L176)
1 parent f5d0741 commit 441bff5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎Coder-Desktop/Coder-Desktop/Views/LoginForm.swift‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ func validateURL(_ url: String) throws(LoginError) -> URL{
194194
guardlet url =URL(string: url)else{
195195
throw.invalidURL
196196
}
197-
guard url.scheme =="https"else{
198-
throw.httpsRequired
197+
guard url.scheme =="https"|| url.scheme =="http"else{
198+
throw.invalidScheme
199199
}
200200
guard url.host !=nilelse{
201201
throw.noHost
@@ -204,7 +204,7 @@ func validateURL(_ url: String) throws(LoginError) -> URL{
204204
}
205205

206206
enumLoginError:Error{
207-
casehttpsRequired
207+
caseinvalidScheme
208208
case noHost
209209
case invalidURL
210210
case outdatedCoderVersion
@@ -213,12 +213,12 @@ enum LoginError: Error{
213213

214214
vardescription:String{
215215
switchself{
216-
case.httpsRequired:
217-
"URL must use HTTPS"
216+
case.invalidScheme:
217+
"Coder URL must use HTTPS or HTTP"
218218
case.noHost:
219-
"URL must have a host"
219+
"Coder URL must have a host"
220220
case.invalidURL:
221-
"Invalid URL"
221+
"Invalid Coder URL"
222222
case.outdatedCoderVersion:
223223
"""
224224
The Coder deployment must be version \(Validator.minimumCoderVersion)

0 commit comments

Comments
(0)