Skip to content

HAProxy configuration instruction bug #7

@Mahdij505

Description

@Mahdij505

403 Forbidden error

As I was trying to configure my HAProxy loadbalancer, I used default template provided in documentation but there was a bug! even though I configured everything correctly and everything was working fine, I couldn't access my panel and I recived (403 Forbiden) error. so I figured out it was a bug in configuration file.
The "http_request deny"" rule will execute first although it's written after "use_backend's" and it leads to 403 error. this is the fix for it:

  1. Remove http_request deny first.
  2. Add this new line after use_backend's, so when none of use_backend's executed this rule will execute:
# ... previous config ...
    
    use_backend panel if host_panel
    use_backend sub   if host_sub

    # If nothing matches above, it goes here:
    default_backend deny_backend
  1. Add this line to the bottom of the file:
backend deny_backend
    mode http
    http-request deny deny_status 403

Make sure spacing is correct ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions