Does 'option accept-invalid-http-response' work in HAProxy 1.7.12? - haproxy

The server I am connecting to is returning what looks like an invalid Date header and I want HAProxy to ignore the error.
Unfortunately I have no control over the server, I am using a third party tool.
I have tried 'option accept-invalid-http-response' in both the backend and defaults sections, with the same result.
The invalid header isn't being ignored,
my client always gets a '502 Bad Gateway' response.
From 'shows errors'
[21/Dec/2020:14:40:59.197] backend <BACKEND> (#3): invalid response
frontend <FRONTEND> (#2), server <SERVER> (#1), event #5
src <IP>:46508, session #6, session flags 0x0000008e
HTTP msg state MSG_RQBEFORE(0), msg flags 0x00000000, tx flags 0x08600000
HTTP chunk len 0 bytes, HTTP body len 0 bytes
buffer flags 0x80008021, out 0 bytes, total 50 bytes
pending 50 bytes, wrapping at 16384, error at position 50:
00000 HTTP/1.1 204 OK\r\n
00017 Date: Mon Dec 2020 14:40:58 GMT\r\n
Or maybe there is something else wrong with the response header.
Any help would be appreciated.

Related

TCP response breaks after 1460bytes

Response from one linux server to another linux server breaks after 1460 bytes , checked on server (MTU is default 1500).
but why it is happening to few requests only because all responses are more than 1460 bytes.

HAProxy cuts parameters in log

Good day everyone!
I’m migrated from haproxy 1.5 to 1.7.11 and I have some troubles with logging
I have a following in config file for logging
capture request header Host len 200
capture request header Referer len 200
capture request header User-Agent len 200
capture request header Content-Type len 200
capture request header Cookie len 300
log-format %[capture.req.hdr(0),lower]\ %ci\ -\ [%t]\ \"%HM\ %HP\ %HV\"\ %ST\ \"%[capture.req.hdr(3)]\"\ %U\ \"%[capture.req.hdr(1)]\"\ \"%[capture.req.hdr(2)]\"\ \"%[capture.req.hdr(4)]\"\ %Tq\ \"%s\"\ 'NGINX-CACHE-- "-"'\ \"%ts\»
Logformat is almost the same with Nginx
But is some cases it works incorrectly
For example log output
Nov 20 10:41:56 lb.loc haproxy[12633]: example.com 81.4.227.173 - [20/Nov/2019:10:41:56.095] "GET /piwik.php H" 200 "-" 2396 "https://example.com/" "Mozilla/5.0" "some.cookie data" 19 "vm06.lb.loc" NGINX-CACHE-- "-" "—"
Problem is that "GET /piwik.php H" must be "GET /piwik.php HTTP/1.1"
its %HV parameter in log-format
A part of "HTTP/1.1" randomly cut’s off. It may be "HT" or "HTT" or "HTTP/1."
I think we have discussed this on the HAProxy mailing list.
https://www.mail-archive.com/haproxy#formilux.org/msg35426.html
There are some bug fixes in the buffer handling therefore please try to update to the latest 1.7.
As you mentioned on the HAProxy list that you use CentOS 6 and you use the packages from ius repo please install 1.7.12 which is listed on the page below.
https://repo.ius.io/6/x86_64/packages/h/
As described in documentation:
req.hdr(): [...] The function considers any comma as a delimiter for distinct values. If full-line headers are desired instead, use req.fhdr(). [...]
So, you should use req.fhdr() to have the full header value.
For example, like this:
http-request capture req.fhdr(User-Agent) len 256k
Information from issue thread in official repository.

Unable to hide CONNECT requests in Fiddler

I'm using Fiddler v4.6.20171.26113 on Windows 8.1. I have enabled the Hide CONNECTs option under the Rules menu and even tried put this script in the custom rules file:
if (oSession.HTTPMethodIs("CONNECT"))
{
oSession["ui-hide"] = "true";
}
However the CONNECT requests are still shown even when their flag UI-HIDE: true is set.
SESSION STATE: Done.
Response Entity Size: 0 bytes.
== FLAGS ==================
BitFlags: [ResponseGeneratedByFiddler, IsDecryptingTunnel, ProtocolViolationInRequest, RequestBodyDropped] 0x10a100
HTTPS-CLIENT-SESSIONID: empty
HTTPS-CLIENT-SNIHOSTNAME: mtalk.google.com
LOG-DROP-REQUEST-BODY: yes
LOG-DROP-RESPONSE-BODY: yes
UI-BACKCOLOR: LightYellow
UI-HIDE: true
X-CLIENTIP: ::ffff:***.***.**.**
X-CLIENTPORT: 5033
X-EGRESSPORT: 55428
X-HOSTIP: **.***.***.***
X-HTTPPROTOCOL-VIOLATION: [ProtocolViolation] HTTP/1.1 Request was missing the required HOST header.
X-ORIGINAL-HOST:
X-REQUESTBODYFINALLENGTH: 1,384
X-RESPONSEBODYTRANSFERLENGTH: 0
== TIMING INFO ============
ClientConnected: 07:05:03.136
ClientBeginRequest: 07:05:03.339
GotRequestHeaders: 07:05:03.339
ClientDoneRequest: 07:05:03.339
Determine Gateway: 0ms
DNS Lookup: 0ms
TCP/IP Connect: 61ms
HTTPS Handshake: 215ms
ServerConnected: 07:05:03.777
FiddlerBeginRequest: 07:05:03.777
ServerGotRequest: 07:05:03.777
ServerBeginResponse: 00:00:00.000
GotResponseHeaders: 00:00:00.000
ServerDoneResponse: 00:00:00.000
ClientBeginResponse: 07:05:03.777
ClientDoneResponse: 07:05:03.777
Overall Elapsed: 0:00:00.437
The response was buffered before delivery to the client.
== WININET CACHE INFO ============
This URL is not present in the WinINET cache. [Code: 2]
* Note: Data above shows WinINET's current cache state, not the state at the time of the request.
* Note: Data above shows WinINET's Medium Integrity (non-Protected Mode) cache only.
So what should I do now?

403 forbidden message while executing a rest message through Jmeter

I am trying to test a Rest service through HTTP sampler using Jmeter. The first sampler generates a token and I am using this token for authorization in the header manager of another HTTP sampler "GetUserandPolicies"(Rest WS request) using RegEx and ForEach controller. I can see in the view results tree that RegEx is working fine passing the actual token to the next request. But the Rest Request is failing giving a response message as Forbidden and Response Code 403 which means that the server is able to recognise the request but denying the access.There is no port number for this HTTP sampler which I suspect would be the culprit. But, the same test is passing with another tool (iTKO LISA) without any port value. Both the samplers "TokenGeneration" and "GetUserandPolicies" have no port values. I need some help on this. I am using the POST method in the HTTP sampler
Please find the sampler result:
Thread Name: Thread Group 1-1
Sample Start: 2014-01-13 12:12:29 IST
Load time: 1390
Latency: 1390
Size in bytes: 382
Headers size in bytes: 354
Body size in bytes: 28
Sample Count: 1
Error Count: 1
Response code: 403
Response message: Forbidden
Response headers:
HTTP/1.1 403 Forbidden
Server: Apache-Coyote/1.1
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization, X-Requested-With, Content-Type
Content-Type: text/plain;charset=UTF-8
Content-Length: 28
Date: Mon, 13 Jan 2014 06:42:30 GMT
HTTPSampleResult fields:
ContentType: text/plain;charset=UTF-8
DataEncoding: UTF-8
Looking into Access-Control-Allow-Headers: Authorization, X-Requested-With, Content-Type stanza I guess that you're missing proper Authorization header.
In regards to empty port everything is fine, it defaults to port 80 in case of HTTP and 443 in case of HTTPS
There are 2 options on how you can deal with Basic HTTP Authentication:
Pass username and password in URL like protocol://username:password#host:port/path
i.e. http://user:pass#your.server.com/somelocation
Use JMeter HTTP Authorization Manager to construct required "Authorization" header for you.
In case if your authentication system uses other approaches, i.e. Cookie-based, NTLM or Kerberos it's still possible but a little bit more tricky. If so - update this post with all details you can get (i.e. request details) and don't hesitate to leave a comment requesting for more input

Jmeter - why linux gives different answer than windows?

I wrote a test plan on Windows 7. I remotely started a test on two machines, both Windows Vista. A problem came up when I tried do same thing on Linux - I used the same test plan.
I can login a group of users and simulate their behaviour, but when I try to log them out nothing happens.
On windows, they are logout but linux gives me empty response data. Listeners show green status so I'm rather confused to what's going on. Should I change something in properties or is it problem with my script?
EDIT:
Script:
Login user using authorization data. every user gets different JSESSIONID.
Simulate user behaviour using Access Log Sampler.
Logout user.
On Windows, everything works fine login and logout. Listener shows: sample result, request data and response data for every sample.
On linux response data is blank for every sample.
Examples of Sample result for
windows and
linux
Request Data is the same for both.
Response data for linux is blank.
EDIT2:
Test Plan
setUP Thread Group
Clean cache server
Clean file with JSESSIONID
Thread Group
HTTP Request Defaults
Login (once only controller)
Acces Log Sampler
using beanshell script i save JSESSIONID (cookie variable) to file
Cookie Manager
tearDown Thread Group
HTTP Request Defaults
read JSESSIONID from file
logout all users
Cookie Manager
result tree
Summary report
Logout must be performed after all samples from access log are done. That's why i save JSESSIONID to file to share same session between thread group.
Ok somehow I eliminate error with response. Apparently there was a problem with java version on linux server.
Current problem is that when i start remotely script on Linux it doesn't follow redirect. The same script on win XP or Vista follow redirects and user is logout.
Exp.
GET connection.rpc?logout=D5D076123FD6CCBF137FE1673F531006
On Windows I get two redirections and user is logout.
Thread Name: Logout 1-1
Sample Start: 2013-05-18 13:50:52 CEST
Load time: 15
Latency: 13
Size in bytes: 777
Headers size in bytes: 573
Body size in bytes: 204
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK
Response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-wkpl-server-name: OnlineRC2
Content-Type: text/html;charset=UTF-8
Content-Language: en-US
Content-Length: 204
Date: Sat, 18 May 2013 11:50:43 GMT
HTTPSampleResult fields:
ContentType: text/html;charset=UTF-8
DataEncoding: UTF-8
Thread Name:
Sample Start: 2013-05-18 13:50:52 CEST
Load time: 13
Latency: 13
Size in bytes: 374
Headers size in bytes: 374
Body size in bytes: 0
Sample Count: 1
Error Count: 0
Response code: 302
Response message: Moved Temporarily
Response headers:
HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=6D3F7A3774ABB1411A5F8E1744004A71; Path=/WKPLOnline
CacheControl: no-cache
Pragma: no-cache, no-store
Expires: -1
Location: connection.rpc?logout=BE8C04D8538641675A8BFD2490CDDD4D
Content-Length: 0
Date: Sat, 18 May 2013 11:50:43 GMT
Thread Name: Logout 1-1
HTTPSampleResult fields:
ContentType:
DataEncoding: null
Sample Start: 2013-05-18 13:50:52 CEST
Load time: 2
Latency: 2
Size in bytes: 403
Headers size in bytes: 199
Body size in bytes: 204
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK
Response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-wkpl-server-name: OnlineRC2
Content-Type: text/html;charset=UTF-8
Content-Language: en-US
Content-Length: 204
Date: Sat, 18 May 2013 11:50:43 GMT
HTTPSampleResult fields:
ContentType: text/html;charset=UTF-8
DataEncoding: UTF-8
On Linux I don't get redirects and user is not logout.
Thread Name: Logout 1-1
Sample Start: 2013-05-18 13:51:48 CEST
Load time: 18
Latency: 18
Size in bytes: 264
Headers size in bytes: 243
Body size in bytes: 21
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK
Response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=D17A4ABCDE7FB90C1DF702BDCB3827D7; Path=/WKPLOnline
CacheControl: no-cache
Pragma: no-cache, no-store
Expires: -1
Content-Length: 21
Date: Sat, 18 May 2013 11:51:53 GMT
HTTPSampleResult fields:
ContentType:
DataEncoding: null
It is strange because during authorization there are a few redirects and linux performs them correctly.
You should check that jmeter accesses correctly your jsessionid file on linux:
check path is ok (no )
check read access
If you are using distributed testing, issue may be that file is not found by agent or some file is overwritten by another agent
Problem is solve, yupi :)
It turned out that the target server has set the lock for some machines. On such a machine was a Linux. That is why I could not log users in a separate thread.
Therefore, if someone encounters a similar problem (from one machine request are handled correctly from another are not), he should check if his machine have correct permission in my case i needed to do correct entry in adm.list in test server.