Skip to content
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

Feature request: Define optional Host for relative URL paths #14

Open
JuJup opened this issue Dec 11, 2024 · 0 comments
Open

Feature request: Define optional Host for relative URL paths #14

JuJup opened this issue Dec 11, 2024 · 0 comments

Comments

@JuJup
Copy link

JuJup commented Dec 11, 2024

Description

I'm using go-esi in an Traefik + Kubernetes Setup, so I'll explain the feature request based on that.
It would be nice if one could add in the ESI Middleware config, what (local) host would be used, when a relative URL is used for an include. That would make some setups easier, where a single Traefik is routing multiple apps.

Right now, a relative url like /my-esi-content/whatever will be run against the localhost of the Traefik Pod itself. It would make sense to define per Middleware, what the default host is.

Example

Simple solution:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
    name: esi
    namespace: my-app
spec:
    plugin:
        go-esi:
            default-host:
                url: static-webserver.my-app.svc.cluster.local

Full solution:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
    name: esi
    namespace: my-app
spec:
    plugin:
        go-esi:
            default-host:
                service: static-webserver
                namespace: my-app

I'd prefer the full solution, as it is the "Kubernetes way" of fully defining the Service and you'd have all the benefits of having references etc.

Why not defining the host in the ESI include itself?

One might ask, why I'm not defining the host in my HTML file directly instead of using relative URLS. While this is of course possible, it would mean, I couldn't reuse any built applications to deploy in other environments. Right now, I need to rebuild my application for dev, testing, prod - only because the host for my ESI includes changes. If I could move this parametrization into the Middleware config, I could reuse my container and simply edit the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant