It is possible with nginx to auth a request via backend service such as
location /somewhere_restricted {
auth_request /isallowed;
}
location = /isallowed {
proxy_pass backend_auth
}
However the backend_auth is check at each http request. Is it possible to authorize a TCP socket? The socket will be authorized once and then all http requests made through it would be going through. Noting I am using http2
This is what is happening with websocket for instance, but I would need the same functionality for normal http requests, and I could not find anything related to this yet
There is no such thing as an authorized TCP socket. Authorization is part of the application protocol and a generic TCP socket has no specific application protocol. Also the location is specific to the HTTP protocol, i.e. generic TCP has no location.