Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add s suffix to use HTTPS for ports#12862

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
f0ssel merged 10 commits intomainfromf0ssel/protocol-s
Apr 9, 2024
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
feat: add s suffix to use HTTPS for ports
  • Loading branch information
@f0ssel
f0ssel committedApr 3, 2024
commit87ae0be9a34a16de5f7d5291bafc8f07bb2b07b1
13 changes: 12 additions & 1 deletioncoderd/workspaceapps/request.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -291,7 +291,18 @@ func (r Request) getDatabase(ctx context.Context, db database.Store) (*databaseR
appURL string
appSharingLevel database.AppSharingLevel
portUint, portUintErr = strconv.ParseUint(r.AppSlugOrPort, 10, 16)
protocol = "http"
)
// If we fail to parse the port, see if it's a port with a trailing "s" for
// HTTPS.
if portUintErr != nil && strings.HasSuffix(r.AppSlugOrPort, "s") {
appSlugOrPort := strings.TrimRight(r.AppSlugOrPort, "s")
portUint, portUintErr = strconv.ParseUint(appSlugOrPort, 10, 16)
if portUintErr == nil {
protocol = "https"
}
}

if portUintErr == nil {
if r.AccessMethod != AccessMethodSubdomain {
// TODO(@deansheather): this should return a 400 instead of a 500.
Expand All@@ -312,7 +323,7 @@ func (r Request) getDatabase(ctx context.Context, db database.Store) (*databaseR
// "anonymous app". We only support HTTP for port-based URLs.
//
// This is only supported for subdomain-based applications.
appURL = fmt.Sprintf("http://127.0.0.1:%d", portUint)
appURL = fmt.Sprintf("%s://127.0.0.1:%d", protocol, portUint)
appSharingLevel = database.AppSharingLevelOwner

// Port sharing authorization
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp