-
-
Notifications
You must be signed in to change notification settings - Fork 124
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(http): BaseUrl handling #1298
base: develop
Are you sure you want to change the base?
Conversation
Since that's where the api endpoint is that way we set it to the root domain, we can't set it to the subfolder since the api is called directly now and not using the baseUrl.
When user for example is in `/autobrr` and hit reload it should just return the index.html.
Remove the trailing `/`, now base url is set to /autobrr aligned with other arrs.
I don't think we need separate router, but I didn't test it, so feel free to test it and see if it works without the separate router, the whole point was to make sure that it's not prefixed with baseUrl and I noticed that it was being called in the frontend `APIClients.ts`. So yea just check if it works without it then keep the old one. Also removed the index since it was zombie code not being used anywhere.
// Dynamically determine the base URL | ||
window.BASE_URL = '{{.BaseUrl}}'; | ||
|
||
// Update the base tag dynamically | ||
const base = document.createElement('base'); | ||
base.href = window.BASE_URL; | ||
document.head.appendChild(base); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could move this block to bellow where the window.APP.baseUrl
is being defined already, than we can use that variable to base.href
base.href = window.APP.baseUrl;
@@ -62,7 +62,7 @@ func (h authHandler) login(w http.ResponseWriter, r *http.Request) { | |||
|
|||
h.cookieStore.Options.HttpOnly = true | |||
h.cookieStore.Options.SameSite = http.SameSiteLaxMode | |||
h.cookieStore.Options.Path = h.config.BaseURL | |||
h.cookieStore.Options.Path = "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be setting cookieStore to /. A significant amount of our users host on baseurls and this will allow other applications on the machine to read the cookie.
Can we get this going again, as it seems pretty much broken at the moment? @kaiserbh still interested in getting this done? Thanks! |
I think this is done, but it's a breaking change. So it won't be released until autobrr hit ver 2.0, probably. |
I tried your change and noticed that when configuring Without trailing slash it works when opening Can somebody confirm, should that be fixed? |
Hopefully closes #1166, I am sure this is a breaking change so do test it thoroughly.
By breaking change I mean maybe proxy level, people might have to update their proxy configuration.
I only tested it with caddy with below config
sse seem to work fine and not seeing any errors.
Anyway do test it.