Skip to content

[BUG] Issue with subdirectory in baseurl #68

Closed
@shanehughes1990

Description

Describe the bug
webserver from yaml file, this is json with yamlencoding (terraform)

"webserver" : {
  "port" : 8585,
  "baseurl" : "/checkrr"
},

My Ingress for this service checkrr.example.com/checkrr is essentially what it resolves too.

domain_match_pattern = "Host(`checkrr.${var.cloudflare_config.zone_name}`) && PathPrefix(`/checkrr`)"

The static site itself doesn't even load just 404, but the api responses don't have the directory delimiter "checkrr/api" between the baseurl and api routes, if you change baseurl to /checkrr/ the api works static site does not.

The issue atleast for the api is on line 84 webserver.go router.Group(w.BaseURL + "api") = /checkrrapi NOT /checkrr/api

To Reproduce
Steps to reproduce the behavior:

  1. Change baseurl to /checkrr
  2. go to http://localhost:8585/checkrrapi/files/bad
  3. You will see the api response

Expected behavior
I want subdirectories for my services so I would want the UI & api both to work when changing the baseurl from the default /

Screenshots
image

Desktop (please complete the following information):

  • OS: windows
  • Browser: chrome
Checkrr version 3.1.4
 Commit: 1daa66a29265db10eb86081e5423af7cf16515a3
 Built On: 2023-07-27T00:47:01Z
 Built By: goreleaser

Additional context
Havent worked with static.Serve from gincontrib at all, but I build golang api's regularly for work (done gin countless times). I would be willing to do a PR for this issue (I'm sure Ill figure out the static site given enough time)

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions