Add configuration option for application root URL#114
Add configuration option for application root URL#114loic-sharma merged 4 commits intoloic-sharma:masterfrom daniel-lerch:master
Conversation
| } | ||
| } | ||
|
|
||
| app.UsePathBase(Configuration.Get<BaGetOptions>().PathBase); |
There was a problem hiding this comment.
Does this throw if PathBase is null? If it does, please add a null check.
There was a problem hiding this comment.
This option does not throw on null.
|
Looks great! I left some minor comments, I'll merge once you've addressed them :) |
|
This PR will take longer than expected. I experienced problems with the configuration as some URLs are kind of hard-coded and are not adjusted by changing the |
|
Sounds good. Let me know if you have any questions |
|
The API can now be configured to run under a different For the web UI it is not that easy to configure the base path as the site is served as static content. Two ways to resolve this problem:
|
|
Ah I see. Today, the frontend's API endpoints are hardcoded in the code base. My recommendation for you:
This is a short-term solution that should let you host BaGet in a different root URL. I'd like to make the backend's endpoint configurable at build time, but I will be investing in other areas first (unit test coverage and an actual release process). Please let me know if you run into any issues! |
|
Is there anything missing to merge this PR or do you want to wait until the frontend will work with a different root URL? |
|
Your changes look good! I moved some things around after you opened this pull request - would you mind reapplying your changes on the latest master? I'll go ahead and merge after :) |
|
I just merged your changes into my fork. |
|
Thank you :) |
|
Hello, I'm trying to use this, but it is not working right now. appsettings.json: |
|
The However, the Web UI does not work as mentioned above. |
|
Is there any solution for having BaGet incl. UI behind a proxy? I got the feeling I'm missing something obvious here. |
|
There is currently no way to run BaGet's web UI with a different root URL. @loic-sharma recommend to change the hard-coded URLs in one's own fork (see above). |
|
I haven’t tested this, but you should be able to add the |
|
After trying different things imcluding homepage, basename etc. I've to say, that i'm not making any progress. I need to take a look at this topic again. Thank you for your effort and your help so far. |
…irror (loic-sharma#114) * Implementation, docs, and basic tests * Split mirror options file into file for each class * Restructure documentation for mirror * Update mirror auth tests adds missing verify share common setup * Revert splitting mirror doc into separate page * Fix incorrent validation condition --------- Signed-off-by: Marlon Regenhardt <marlon.r@hotmail.de> Co-authored-by: Marlon Regenhardt <marlon.r@hotmail.de>
What does this PR do?
This pull request adds the setting
PathBaseto the BaGet configuration and applies this setting on startup. ThePathBaseoption allows an ASP.NET Core application to run under a different root URL than it was designed for.Motivation
I want to operate a BaGet server with a URL like https://example.com/baget and reach the API index at https://example.com/baget/v3/index.json. With this change I don't have to write complex rewrite rules for this scenario which might not work at all.
Additional Notes
Deal with path base and proxies that change the request path on Microsoft Docs