Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nchan_subscriber_type isn't accessible by lua access block #678

Open
KamranBiglari opened this issue Jan 2, 2024 · 0 comments
Open

nchan_subscriber_type isn't accessible by lua access block #678

KamranBiglari opened this issue Jan 2, 2024 · 0 comments

Comments

@KamranBiglari
Copy link

I tried to access nchan_subscriber_type but value is null in access_by_lua_block stage.
How it's possible to get the connection type ?
I want to know it's HTTP or WEBSOCKET

location ~ "^/live/midrate/v1/rates/([A-Z]{3})([A-Z]{3})/(SPT|SN|ON|TN|W[1-3]|M[1-9][0-9]?|Y[2-5])/([D,N])/([O])/?$" {
    # Default settings
    default_type 'application/json;charset=UTF-8';

    # nchan authorization settings

    nchan_message_buffer_length 1;

    nchan_message_timeout 96h;
    nchan_subscriber;
    nchan_channel_id "midrate-v1-$1$2-$3-$4-$5";
    client_max_body_size 0;
    nchan_subscribe_existing_channels_only on;

    access_by_lua_block {
    local res = ngx.location.capture("/auth/verify/authorization/v1/",{
      args = {
        key = "fiat.live.midrate.rates.".. ngx.var[3],
        channels = ngx.var.nchan_subscriber_type,
        instruments = { ngx.var[1], ngx.var[2] }
      }

    })
    if res.status ~= ngx.HTTP_OK then
      ngx.exit(res.status)
    end
    }

@slact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant