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
0
votes
2 answers

Lua: get POST data

I'm receiving this JSON in the POST data: { "foo":{ "hi": "there", "hello": "world" } } In Lua, I want to get foo in order to save it in Redis, so it'd be great to save it as an string. How can I get it?
loar
  • 1,505
  • 1
  • 15
  • 34
0
votes
1 answer

use ngx.timer.at function in init_worker_by_lua_file seems does not work

I want to use ngx.timer.at module to start another thread besides the "main" thread for lua worker process. From the documentation, it turned out the ngx.timer.at module make this pretty easy to achieve. However, when I have this simple code, it…
Yongxin Zhang
  • 87
  • 1
  • 3
0
votes
1 answer

nginx docker file cannot open file

I am writing to a create a docker file to run openresty nginx in a container. my docker file is below. FROM ubuntu:latest ENV PATH="/usr/local/openresty/nginx/sbin:${PATH}" LABEL info="running open resty on docker container" RUN apt-get…
GAK
  • 1,018
  • 1
  • 14
  • 33
0
votes
1 answer

ngx.escape_uri() didn't work on '/'?

I'm trying to encode a url as an arg value like this url = "http://test.com?a=1&b=2" encode_url = "http://domain?url="..ngx.escape_uri(url) then it became http://domain?url=http%3A//test.com%3Fa%3D1%26b%3D2 but i want to…
pearzl
  • 323
  • 1
  • 2
  • 10
0
votes
1 answer

How to capture and append to an HTML body tag with patterns in lua

I have an HTML page with the following opening body tag: And I'm using lua patterns append a div to the end:
How do I do…
Amin Shah Gilani
  • 8,675
  • 5
  • 37
  • 79
0
votes
1 answer

Unable to download geoip module via luarocks

I am trying to install geoip module via luarocks but it showing errors multiple times. luarocks --from=http://geoip.luaforge.net/rocks install geoip --verbose Output io.popen: 'pwd' os.execute: cd '/usr/local/share/lua/5.1' && test '-e'…
Obivan
  • 361
  • 1
  • 3
  • 9
0
votes
2 answers

How to process response from www-authenticate in nginx?

I'm using openresty nginx v1.11.2.4. I wish to be able to authenticate users before they are given access to a resource or before they try to PUT something on the server. I am using the http_auth_request_module and the following is an except from my…
Ayudh
  • 1,673
  • 1
  • 22
  • 55
0
votes
0 answers

How to resolve redis connect runtime error?

I am trying to access redis from a lua script in my nginx.conf file on my openresty nginx server. The following is the lua script, I am using the content_by_lua_file directive to refer to it. local redis = require "resty.redis" local red =…
Ayudh
  • 1,673
  • 1
  • 22
  • 55
0
votes
1 answer

Lua: How to gzip a string (gzip, not zlib) in memory?

Given a string, how can I compress it in memory with gzip? I'm using Lua. It sounds like an easy problem, but there is a huge list of libraries. So far, all that I tried were either dead or I could produce only zlib compressed strings. In my use…
Philipp Claßen
  • 41,306
  • 31
  • 146
  • 239
0
votes
1 answer

How to encode bytes to utf8 in lua?

The string which is decompressed by zlib and been printed to log is in the format of below. …
newbie
  • 301
  • 4
  • 17
0
votes
1 answer

Openresty: create connection to Tarantool on init

I want to create connection to Tarantool database in init_by_lua_block or init_worker_by_lua_block and then use that created connection in each content_by_lua_block: init_by_lua_block { local tnt = require 'resty.tarantool' local tar, err =…
zodiac
  • 353
  • 3
  • 18
0
votes
1 answer

Signature for Azure Table Storage REST API

I am writing some code in Lua to create an item in Azure Table Storage. I have tried Shared Key signatures: local account = 'XXX' local key = 'YYY' local table = 'test' local date = os.date('!%a, %d %b %Y %H:%M:%S GMT', os.time) local sts =…
Adam
  • 1
  • 3
0
votes
0 answers

openresty nginx, there is no work process after starting nginx

I work on windows 10 use built-in bash for ubantu I installed openresty, and start it's nginx with command "nginx -p openresty-test". My nginx.conf content is: worker_processes 2; error_log logs/error.log; events { worker_connections…
Joey.Luo
  • 89
  • 5
0
votes
1 answer

openresty on body_filter_by_lua send socket

I have a demand, is at server return response, send a request to other server, but openresty say API disabled in the context of body_filter_by_lua*. i use module resty.http. thanks
Mad-Hades
  • 25
  • 9
0
votes
1 answer

Can I modify inbuilt Nginx variable with Lua?

the nginx log format is : log_format main '$remote_addr [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" "$cookie_logintoken"'; I set…
weizhao
  • 183
  • 3
  • 16