Questions tagged [openresty]

OpenResty (aka. ngx_openresty) is a full-fledged web application server by bundling the standard Nginx core, lots of 3rd-party Nginx modules, as well as most of their external dependencies.

OpenResty (aka. ngx_openresty) is a full-fledged web application server by bundling the standard Nginx core, lots of 3rd-party Nginx modules, as well as most of their external dependencies.

By taking advantage of various well-designed Nginx modules, OpenResty effectively turns the nginx server into a powerful web app server, in which the web developers can use the Lua programming language to script various existing nginx C modules and Lua modules and construct extremely high-performance web applications that are capable to handle 10K+ connections.

OpenResty aims to run your server-side web app completely in the Nginx server, leveraging Nginx's event model to do non-blocking I/O not only with the HTTP clients, but also with remote backends like MySQL, PostgreSQL, Memcached, and Redis.

OpenResty is not an Nginx fork. It is just a software bundle. Most of the patches applied to the Nginx core in OpenResty have already been submitted to the official Nginx team and most of the patches submitted have also been accepted. We are trying hard not to fork Nginx and always to use the latest best Nginx core from the official Nginx team.

Home: http://openresty.org/

474 questions
1
vote
1 answer

Parse JSON with missing fields using cjson Lua module in Openresty

I am trying to parse a json payload sent via a POST request to a NGINX/Openresty location. To do so, I combined Openresty's content_by_lua_block with its cjson module like this: # other locations above location /test { …
albert
  • 8,027
  • 10
  • 48
  • 84
1
vote
1 answer

Keycloack: After logout, the access token can still be used

I have an nginx/openresty client to a keycloack server for authorization using openid. I am using lua-resty-openidc to allow access to services behind the proxy. The user can access his profile…
ntg
  • 12,950
  • 7
  • 74
  • 95
1
vote
1 answer

OpenResty - No response when making a http call with lua

when making a request to an url from within my nginx the response of this request is always not present. It seems that the request is not sended. This is my nginx.conf worker_processes 1; error_log logs/error.log; events { worker_connections…
Danny
  • 23
  • 5
1
vote
1 answer

Matching variable string with Lua

I'm fighting with the file search script The x99999999 value is continuously variable. How can I find this value with lua match? I need to find and change this variable. /home/data_x99999999_abc_def_0.sh I actually have code that works but I'm not…
SweetNGX
  • 153
  • 1
  • 9
1
vote
1 answer

Proxy an incoming upload file post request using lua-resty-http request module

I am trying to proxy requests using lua-resty-http module. I am currently passing headers, body, request method, and url for http request which works fine. But when a file upload post request comes it is unable to do so, obviously i haven't…
mikasa9002
  • 11
  • 1
1
vote
0 answers

Lua script proxy_pass doesn't work as expected

I am trying to make a reverse proxy with Lua script, Nginx is my proxy. This is my .lua script part that makes the proxy_pass: if content == "200" then proxy_pass https://5dea42df1eeb.ngrok.io; ngx.print("OK!") else return ngx.exit…
jrz
  • 1,213
  • 4
  • 20
  • 54
1
vote
1 answer

OpenResty: not found 'socket' module

I install lua socket module by run the following command: apt install lua-socket When use local socket = require('socket') in OpenResty config, I got the following error: module 'socket' not found: no field package.preload['socket'] no file…
Ren
  • 2,852
  • 2
  • 23
  • 45
1
vote
0 answers

LUA IPv6 to Long

Using the module below, I can long IPv4 address. How can I do the same for IPv6? function ip2long(ip) local inp = ffi.new("struct in_addr[1]") if C.inet_aton(ip, inp) ~= 0 then return tonumber(C.ntohl(inp[0].s_addr)) end …
SweetNGX
  • 153
  • 1
  • 9
1
vote
0 answers

How to get matched location_name on runtime by lua in openresty

In rewrite_by_lua phase, I want to get the matched location name on runtime。 For example: nginx server config: server { listen 80; server_name 127.0.0.1; location /test { return 200 "test"; } location /test/api { …
zhaosen
  • 11
  • 1
1
vote
4 answers

LUA delete 2 different characters with gsub

I want to delete two different characters at the beginning and end of my_string with gsub.. But I managed to delete only one.. local my_string = "[I wish you a happy birthday]" local new_string = bouquet:gsub('%]', '') …
SweetNGX
  • 153
  • 1
  • 9
1
vote
2 answers

module 'resty.http' not found: while resty is installed

I am facing an issue while testing a sample code using resty cli. Please find the output of related commands: $ which resty /usr/local/bin/resty $ which openresty /usr/local/bin/openresty $ resty -e 'ngx.say("hello world")' hello…
Rishabh Sairawat
  • 440
  • 6
  • 17
1
vote
1 answer

debug openresty with zerobrane

I've followed this tutorial to setting up Zerobrane IDE for debugging openresty: http://notebook.kulchenko.com/zerobrane/debugging-openresty-nginx-lua-scripts-with-zerobrane-studio. I installed openresty 1.19.3.1 from a brew formula, and lua scripts…
George Livanoss
  • 443
  • 1
  • 4
  • 14
1
vote
1 answer

lua setting an expiration time using the redis command with 'setex' appears as a permanent key in openresty

setting an expiration time using the redis command appears as a permanent key when i do this in openresty with lua script. the lua script is follow this: local function ip_frequency(ip,red) local limit_num=50 local key =…
Leandy
  • 595
  • 1
  • 5
  • 14
1
vote
1 answer

Nginx ignores access_by_lua_file with proxy_pass

I use OpenResty in my project and faced issue that nginx ignores access_by_lua_file when use proxy pass. Here is my code of location: location /getapi { internal; set $apiauth ''; set…
balamutik
  • 161
  • 5
1
vote
1 answer

Openresty Lua : cannot connect to redis after receiving response from api-server

I am making a call limiter based on api key and I am keeping counter of calls in redis where key is my api-key and value is a counter. After threshold or allowed call for that key is reached I throw a message stating your quota reached or…
Saurab
  • 1,931
  • 5
  • 20
  • 33