Skip to content

Commit

Permalink
add '/' to gradio and streamlit space app endpoint to avoid http redi…
Browse files Browse the repository at this point in the history
…rect (#119)

Co-authored-by: Lei Da <[email protected]>
  • Loading branch information
Rader and Lei Da authored Sep 14, 2024
1 parent 3b3c1ba commit db5221c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion component/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ func (c *SpaceComponent) Show(ctx context.Context, namespace, name, currentUser
svcName, status, _ := c.status(ctx, space)
if len(svcName) > 0 {
if c.publicRootDomain == "" {
endpoint, _ = url.JoinPath(c.serverBaseUrl, "endpoint", svcName)
if space.Sdk == scheduler.STREAMLIT.Name || space.Sdk == scheduler.GRADIO.Name {
// if endpoint not ends with /, fastapi based app (gradio and streamlit) will redirect with http 307
// see issue: https://stackoverflow.com/questions/70351360/keep-getting-307-temporary-redirect-before-returning-status-200-hosted-on-fast
endpoint, _ = url.JoinPath(c.serverBaseUrl, "endpoint", svcName, "/")
} else {
endpoint, _ = url.JoinPath(c.serverBaseUrl, "endpoint", svcName)
}
endpoint = strings.Replace(endpoint, "http://", "", 1)
endpoint = strings.Replace(endpoint, "https://", "", 1)
} else {
Expand Down

0 comments on commit db5221c

Please sign in to comment.