Skip to content

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

Open
@JuJup

Description

@JuJup

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions