gregtwallace / certwarden

Cert Warden is a centralized ACME Client. It provides an API for certificate consumers to fetch their individual keys and certs with API keys.
https://www.certwarden.com/
Other
176 stars 6 forks source link

[feat] Support for subpath for reverse proxies #12

Closed xorguy closed 1 year ago

xorguy commented 1 year ago

Hi.

For those only using DNS challenge a subpath support will help to serve the app under same domain as others applications, no need to use a subdomain. Right now the application loads http://mylegocert/app, it will help to allow to set a subpath so application can load in URL like https://my_reverse_proxy_server/legocerthub/app.

gregtwallace commented 1 year ago

I went down this road a little bit in the past. The backend this is super easy to implement. However, React is a roadblock.

Specifically, when the frontend builds, the paths are hard coded. There is no easy way to modify the base path at runtime. The only idea I currently have that might work is replacing all of the paths in the frontend files every time LeGo launches but that sounds like quite a manual mess which would likely make it error prone.

Alternatively, I could change the default path to always include /legocerthub first, but I'm not sure I'm in love with that idea.

If you have any React expertise I'm all ears. I've searched a lot and tried a number of different methods but all roads seem to lead back to those darn hardcoded paths.

xorguy commented 1 year ago

Hi.

Because I have no expertise on React I was just wondering if it was feasible, even if I was able to try I would give a try but I don't know how.

Anyway thanks for the app! Feel free to close this issue.

Regards.

gregtwallace commented 1 year ago

I made the changes to add the path /legocerthub (no option to change it). I’m still debating on merging. The issue is it would require all client scripts to be updated to query the correct api end point (with the additional path).

Current inclination is to just do it but we’ll see.

gregtwallace commented 1 year ago

I realized I can just add some redirects to provide backwards compatibility. I'll get this added.

xorguy commented 1 year ago

Hi, tried latest docker version and even accessing by IP and port, not reverse proxy, the URL that loads is redirected to: http://ip:4050/legocerthub/legocerthub.

Seems is adding a second legocerthub.

Is any config to alter that for when is running under reverse proxy or direct?

gregtwallace commented 1 year ago

I can’t test right now but have you tried in a private browser window? And/or clear cache?

Edit: I see what I did. Should be an easy fix for next release. In the meantime just navigate to /legocerthub/app and you should be fine.

gregtwallace commented 1 year ago

https://github.com/gregtwallace/legocerthub/issues/15