Skip to content

issues with http_settings.path and http_settings.api_prefix #597

@danjenkins

Description

@danjenkins

It appears as though (at least in the docker container - 1.5.4) the index.html file that gets generated, doesn't have window['base-href'] = '/'; in it, and so even if you pass in a "HTTP_PATH" via env var into the docker container, theres nothing there to change.... and so you never get a change of the base href

homer-app/main.go

Line 1784 in 0afc13e

newBody := strings.ReplaceAll(string(content), "window['base-href'] = '/';", "window['base-href'] = '"+relativePath+"/';")

Theres no real documentation on how to run Homer on a sub path like http://domain.com/homer

I think the right way to do that is now using the api_prefix but you can't change that using env vars in the docker image, its a a param you can only change by using command line flags....

I added the commands into the docker-compose file command: ["/homer-app", "-webapp-config-path=/usr/local/homer/etc", "-webapp-api-prefix=/homer"] and it appears to be set right when I inspect the docker container but alas, if I curl http://localhost:9080/homer I get a Not Found. If I curl http://localhost:9080 then it still responds....

IF api_prefix is the right way of doing this then it seems some routes aren't going to respond to the prefix anyway...

homer-app/main.go

Lines 1708 to 1764 in 0afc13e

func registerGetRedirect(e *echo.Echo, path string) {
prefix := *appFlags.APIPrefix
if viper.IsSet("http_settings.api_prefix") {
prefix = viper.GetString("http_settings.api_prefix")
}
e.GET(prefix+"/dashboard/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/call/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/call/:name/", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/search/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/search/:name/", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/registration/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/registration/:name/", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"(system:login)", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET(prefix+"/preference/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET("/transaction/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET("/search/result/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
e.GET("/search/:name", func(c echo.Context) (err error) {
return sendIndexHtml(c, path)
})
}

I'm lost as to how you're meant to run homer 7 on a subpath in docker using the docker-compose file (those docker-compose files should really get updated to use the images from github instead of the outdated ones from dockerhub)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions