'websocket calls in jmeter returning 401

Problem statement: Jmeter webSocket request-response sampler is returning response code 401. with Response message:Got unexpected status 401 with statusLine:HTTP/1.1 401 Unauthorized Reason for unauthorization is very confusing

Questions:

  • The documentation says headers are taken by default, I have NTLM auth for wss, if i add the header in HTTP header manager will it work?
  • There are references that say port has to be 443 for wss communication, in my application the IP address is given as wss://optiPerf02:8081 (A new port is open for new user). How to proceed on this


Solution 1:[1]

  1. Yes it will, but calculating the relevant Authorization header value for NTLM might be tricky, see Windows Authentication with Apache JMeter for more details. Have to tried to use existing connection as I see some sampler which does "negotiation" so it might be a better idea to re-use the established connection as it might derive valid authentication context from the HTTP session:

    enter image description here

  2. The references mainly follow default ports for HTTP and HTTPS, however the WebSocket server might be running on any port.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T