hdr fetch doesn't work for response headers in 1.8.20 · Issue #153 · haproxy/haproxy · GitHub
Skip to content

hdr fetch doesn't work for response headers in 1.8.20 #153

Closed

Description

@tmccombs

Output of haproxy -vv and uname -a

HA-Proxy version 1.8.20 2019/04/25
Copyright 2000-2019 Willy Tarreau <willy@haproxy.org>

Build options :
  TARGET  = linux2628
  CPU     = generic
  CC      = gcc
  CFLAGS  = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-unused-label
  OPTIONS = USE_LIBCRYPT=1 USE_CRYPT_H=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_LUA=1 USE_SYSTEMD=1 USE_PCRE=1 USE_PCRE_JIT=1

Default settings :
  maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with OpenSSL version : OpenSSL 1.0.2g  1 Mar 2016
Running on OpenSSL version : OpenSSL 1.0.2n  7 Dec 2017
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2
Built with Lua version : Lua 5.3.1
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Encrypted password support via crypt(3): yes
Built with multi-threading support.
Built with PCRE version : 8.38 2015-11-23
Running on PCRE version : 8.39 2016-06-14
PCRE library supports JIT : yes
Built with zlib version : 1.2.8
Running on zlib version : 1.2.11
Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
Built with network namespace support.

Available polling systems :
      epoll : pref=300,  test result OK
       poll : pref=200,  test result OK
     select : pref=150,  test result OK
Total: 3 (3 usable), will use epoll.

Available filters :
        [SPOE] spoe
        [COMP] compression
        [TRACE] trace
Linux <redacted> 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

What's the configuration?

defaults
  mode http
  timeout connect 50000
  timeout client 50000
  timeout client-fin 5000
  timeout server 30000


frontend test1
  bind :8900

  http-response set-header test %[hdr(content-length)]

  default_backend httpbin


backend httpbin
  http-request set-header Host httpbin.org

  server test httpbin.org:80

Steps to reproduce the behavior

  1. Run haproxy with the above config
  2. curl localhost:8900/get -D - -o /dev/null -S
  3. look at headers in response

Actual behavior

The "test" header is empty

Expected behavior

The "test" header should have the value of the "content-length" header in the response. This is how it worked in 1.7 and 1.8.14, and according to the documentation:

[hdr] is equivalent to ... res.hdr() when used on responses

And the above configuration does work as expected if the hdr fetch is changed to res.hdr.

Do you have any idea what may have caused this?

This appears to have been introduced between 1.8.14 and 1.8.20. Since my code was working when running 1.8.14 but broken when I upgraded to 1.8.20.

Do you have an idea how to solve the issue?

No

Activity

  1. added
    severity: minorThis issue is of MINOR severity.
    status: fixedThis issue is a now-fixed bug.
    and removed on Jul 3, 2019
  2. lukastribus commented on Jul 3, 2019

    @lukastribus
    Member

    This is already fixed by commit c1f40dd (BUG/MINOR: http_fetch: Rely on the smp direction for "cookie()" and "hdr()") and will be released with v1.8.21.

    The regression was introduced in v1.8.20.

  3. tmccombs commented on Jul 4, 2019

    @tmccombs
    ContributorAuthor

    oh, ok thanks.

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

    severity: minorThis issue is of MINOR severity.status: fixedThis issue is a now-fixed bug.type: bugThis issue describes a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions