0

For example, I have nginx and incoming JSON header:

{
  "orgs" : {
    "first_org_roles": ["role_a_r", "role_b_r", "role_c_r"],
    "second_org_roles": ["role_d_r", "role_e_r", "role_f_r"]
  }
}

Is it possible to parse it into an array:

["role_a_r", "role_b_r", "role_c_r", "role_d_r", "role_e_r", "role_f_r"]

and set it as a header in nginx?

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
nvp
  • 1
  • This is not a header, it's JSON data. And it has nothing to do with nginx. – Gerald Schneider Nov 14 '22 at 07:21
  • If course it can be parsed that way. But to say how people need to know what you want to use to do it. What scripting/programming language/tool you want to use. – Gerald Schneider Nov 14 '22 at 07:22
  • No, it's exactly header looks like json. My authentication service generates this header and sends me. And I should parse it and forward it further, to my services. – nvp Nov 14 '22 at 07:28
  • Yeah, sorry, I just read it again and realized I missed some parts. Some details are still missing though. are these headers that you get by a client and want to send it to some backend you are proxying for? Or the other way around? – Gerald Schneider Nov 14 '22 at 07:30
  • Yes, my component has authentication by headers, but incoming header from my authentication service sends me this json with roles and it's incompatible. I wanna try to parse it with nginx. – nvp Nov 14 '22 at 07:37

0 Answers0