Skip to content

Remove hardcoded https scheme and use appropriate scheme depending on environment. #2941

@DanielRyanSmith

Description

@DanielRyanSmith
Contributor

Background

There are places in the code where the url scheme is hardcoded to https. As a result, when a developer has all of the micro services up locally, the webapp micro service cannot call the search cache service because the scheme is hardcoded.

Definition of Done

  • Find all places of hardcoded with https and have it use the appropriate scheme depending on where it is deployed (locally or google cloud)
    The microservices work together not only when deployed but locally.

Examples (not exhaustive)

Example 1:

wpt.fyi/api/query/search.go

Lines 165 to 166 in cee243f

// TODO(Issue #2941): This will not work when hostname is localhost (http scheme needed).
fwdURL, err := url.Parse(fmt.Sprintf("https://%s/api/search/cache", hostname))

Example 2:

url := "https://" + wptdHost + "/api/runs"
url += "?" + filter.OrDefault().ToQuery().Encode()

Example 3:

HostURL: fmt.Sprintf("https://%s/", host),

Example 4:

result, _ := url.Parse(fmt.Sprintf("https://%s%s", a.GetVersionedHostname(), "/api/results/upload"))

Example 5:

detailsURL, _ := url.Parse(fmt.Sprintf("https://%s%s", host, path))

Example 6:

detailsURL, _ := url.Parse(fmt.Sprintf("https://%s/results/", d.aeAPI.GetHostname()))

Example 7:

diffURL, _ := url.Parse(fmt.Sprintf("https://%s/api/search", d.aeAPI.GetVersionedHostname()))

Example 8:

CallbackURL: fmt.Sprintf("https://%s/api/results/create", a.GetVersionedHostname()),

Example 9:

callback := url.URL{Scheme: "https", Host: r.Host, Path: "oauth"}

Activity

changed the title [-]Search cache testing will not work when hostname is localhost (http scheme needed)[/-] [+]Remove hardcoded https scheme and use appropriate scheme depending on environment.[/+] on Sep 30, 2022
self-assigned this
on Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @jcscottiii@DanielRyanSmith

    Issue actions

      Remove hardcoded https scheme and use appropriate scheme depending on environment. · Issue #2941 · web-platform-tests/wpt.fyi