1

For SEO reasons I want to return "410 Gone" for some specific URLs which I will match using path_beg or path_sub.

I've tried the following:

frontend foo
    mode http
    bind :80

    # 1) this works but I cannot use 410
    http-request deny deny_status 408 if { path_sub bar }

    # 2) this doesn't work at all no matter the code
    http-response set-status 408 if { path_sub test }

I cannot use 410 in the first directive with http-request because https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#errorfile:

<code> is the HTTP status code. Currently, HAProxy is capable of generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502, 503, and 504.

The second directive with the http-response doesn't have any effect.

How can I return a 410?

3
+50

This error code will be available in the upcoming 2.2 errorfile

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.