Monviech / os-caddy-plugin

Caddy Plugin with GUI for OPNsense
Other
38 stars 0 forks source link

Feature request: redirect option #91

Closed pmhausen closed 6 months ago

pmhausen commented 6 months ago

Hi!

I need something like this:

redir / /guacamole/ 308

inside a reverse proxy domain context.

I am not quite sure about the best place to put this in the UI. As a first idea I suggest creating a third section in the "Access" tab labelled "Redirects", then activating predefined redirect statements in the domain configuration similar to basic authentication.

What do you think?

Kind regards, Patrick

Monviech commented 6 months ago

I would like to know why this is needed and why the current reverse proxy options can't just reverse proxy to that app. Is that Apache Guacamole?

pmhausen commented 6 months ago

Yes. If you don't redirect you end up with the tomcat home page.

Monviech commented 6 months ago

What happens if you use the handle_path directive to directly go into /guacamole/* while stripping the path from the domain? Its supported in the GUI.

https://caddyserver.com/docs/caddyfile/directives/handle_path

pmhausen commented 6 months ago

I thought the handle path is used to strip paths from the request? I.e.

https://external.do.main/foo is handled by http://some.internal.domain?

Guacamole cannot run at / - it must run in /guacamole/. I learned how to redirect in tomcat but don't entirely trust it. IMHO this is generally best done in the frontend just like HTTP to HTTPS redirects.

Monviech commented 6 months ago

If you want it I'm not holding you back on trying to implement it. It has to work for both domains and subdomains. Maybe a new "Redirect" tab would be good. It can work the same way as the access lists with a model relation field in subdomains and domains.

Its a pretty big change, tell me if you want to do it.

Also, nobody who uses it has requested this yet, it seems like a very specific requirement.

Maybe leveraging the import statement in caddy.d is less of a hazzle for you? You could drop a "guacamole.conf" in there that has the configuration for it.

https://github.com/Monviech/os-caddy-plugin?tab=readme-ov-file#custom-configuration-files

pmhausen commented 6 months ago

I'll fix it with another reverse proxy instance right in the Guacamole jail. This is their recommended way, anyway. Tomcat is kinda weird :)

Case closed.

Monviech commented 6 months ago

Okay, yeah it does sound weird. Thanks for the suggestion though.

If this is requested more often we can always open it up again.

For now its a good choice to keep caddy focused on its core functionality, a reverse plugin thats easy to configure and you dont pull your hair out. ^^

pmhausen commented 6 months ago

BTW: currently Caddy cannot e.g. reverse_proxy http://some.host:some_port/some_path - only scheme, host and path are supported. Well ... using Nginx for that instance. See:

https://guacamole.apache.org/doc/0.9.8/gug/proxying-guacamole.html