query about nginx plugin module for reverse proxy

백종선 jongsun89 at naver.com
Mon Mar 7 12:26:42 UTC 2022


Hello, nginx team.
 
I'm using nginx as reverse proxy .
I'm trying to make nginx plugin module(I'm noob of this) for some purpose .
I have back-server opening websocket behind nginx .
client <-> nginx(reverse proxy) <-> back-server(websocket)
back-server is listening 3 numbers of websocket.
- websocket(A)
- websocket(B) 
- websocket(C) 
I'd like to watch websocket(only A) connection status(connection fail/opened/closed) in nginx plugin module for some purpose.
i can catch the request websocket 'A' connection in nginx plugin module by registering NGX_HTTP_ACCESS_PHASE handler(parse header and compare subprotocol(A) of http request).
Query :
Now, how can i get the websocket connection status(connection fail/opened/closed) event with the same http request context getting from NGX_HTTP_ACCESS_PHASE handler ?
scenario : 
 1. get websocket(A) connection request in nginx plugin module .
 2. catch event in nginx plugin moudle when the request failed / opened and closed .
 3. when the connection is opened or closed,i do some work .
More query :
Is the context from NGX_HTTP_ACCESS_PHASE handler valid until websocket connection closed?  (ngx_http_foo_handler(ngx_http_request_t *r) <- context r )
If not , is there another context valid from http-requested to websocket connection closed?  
 
API & simple sample code will be very helpful .
 
Thank you for your support
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220307/2a43757a/attachment.htm>


More information about the nginx mailing list