Layer7 API Management

 View Only

Status code when authentication failed in the WebSocket Connection policy.

  • 1.  Status code when authentication failed in the WebSocket Connection policy.

    Posted Feb 28, 2023 02:43 AM
    Edited by Eunmi Jang Mar 02, 2023 01:45 AM

    Dear community,

    ENV : Gateway : 10.1 

    I've tested some sample policies which described in the official documents websocket-scenarios and this communities. I tried to make inbound connection policy return specific status code which I want, but I couldn't. It always return 200 or 101 status code.

    case1: 4-6 return 401, case2: 9-11 return 200

    line 5~7 enabled case : The only case where the status code is not 200 is when using assertion requires HTTP Basic Credentials and authenticates against the Internal Identity Provider. 401 returned with text body.

    line 9~11 enabled case : I tried some with 'Customize Error Response' or 'Return Template  Response to Request', but these are always return 200(OK) or 101 (Switching Protocols). I want to handle security error like OAuth2.0 token validation or APIKEY authentication with 4xx or 5xx status code and custom error message.

    Is there any way to return custom error in the WebSocket connection policy?
    Regards,