Skip to content

Configuration for Subdomain | question #28

Closed

Description

@aHVzY2g

Hey Guys,

I am new to HaProxy and therefore this plugin. I need some help to protect certain backends with auth-request. Let say I want to protect the subdomain v2.example.org.

frontend example
        mode http
        bind 122.64.3.1:80
        bind 122.64.3.1:443 ssl crt /etc/ssl/certs/haproxy.pem crt /etc/haproxy/certs/v1Example.pem crt /home/lxc-pve/.acme.sh/example.org/v2Example.pem
        http-request redirect scheme https code 301 unless { ssl_fc }
        option forwardfor

        acl v1Example hdr(host) -i v1.example.org
        acl v2Example hdr(host) -i v2.example.org

        use_backend v1Example if v1Example
        use_backend v2Example if v2Example

backend v1Example
    server v1Example 122.64.3.32:443 check ssl ca-file /usr/local/share/ca-certificates/example.crt

backend v2Example
    mode http
    server v2Example 122.123.35.51:8023 check

From your documentation, I understand how to protect a single path for one backend. So how can I protect hole subdomain, with multiple backends?

Activity

  1. TimWolla commented on Jan 10, 2021

    @TimWolla
    Owner

    From your documentation, I understand how to protect a single path for one backend.

    Actually the example in the README does not explain how to protect a single path, it makes the authentication request for all requests. Are you confusing this with the /is-allowed which is the path of the authentication service?

  2. aHVzY2g commented on Jan 10, 2021

    @aHVzY2g
    Author

    Yes sorry, I mixed this up. For clarification is it possible to protect a single backend with authentication, without spamming the authentication backend if other resources are accessed?

  3. TimWolla commented on Jan 10, 2021

    @TimWolla
    Owner

    Sure, either put the http-request lua.auth-request line into the backend or add an if at the end.

  4. aHVzY2g commented on Jan 15, 2021

    @aHVzY2g
    Author

    All right got it working, anyone looking for examples check out https://www.authelia.com/docs/deployment/supported-proxies/haproxy.html .

  5. Repository owner locked and limited conversation to collaborators on May 19, 2022
  6. converted this issue into a discussion #49 on May 19, 2022
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

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions