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

nginx lua-resty-http no route to host error

I'm trying to make an http request using lua-resty-http. I created a simple get api in https://requestb.in I can make a request using the address: https://requestb.in/snf2ltsn However, when I try to do this in nginx I'm getting error no route to…
MareCieco
  • 157
  • 1
  • 19
2
votes
1 answer

How do I issue an http request after proxy pass? Using openresty (lua + nginx)

I have a similar need to https://github.com/openresty/lua-nginx-module/issues/220 My use case I'm forwarding files to a remote server, through using proxy_pass. I need to pass $body_bytes_sent to a remote url, after proxy pass. I thought about…
galeaspablo
  • 869
  • 5
  • 15
2
votes
1 answer

How to change Content-length in body_filter_by_lua* in openresty

I am using openresty as a proxy server, which may change response from upstream. Directive header_filter_by_lua* is executed before body_filter_by_lua*. But I changed Content-length in body_filter_by_lua*, and headers has been sent at that time. So…
Gang Sun
  • 65
  • 2
  • 7
2
votes
1 answer

How to route to content_by_lua nginx directive depending on both HTTP Action and URL prefix?

I'd like to route all requests sent to my nginx server to my backend application by default, but selectively send API requests with GET HTTP verbs to a OpenResty Lua based REST API backed by a content_by_lua nginx directive. I'm successfully able to…
Eternal Rubyist
  • 3,445
  • 4
  • 34
  • 51
2
votes
3 answers

How do I redirect back to the home page after authentication

I am trying to configure lua-resty-openidc on an NGINX server. How can I redirect back to the Home page once the user is authenticated? When the user is authenticated the callback url is getting the code, session_state and other parameters from the…
2
votes
0 answers

client closed connection in nginx error log

I am using openresty with redis for a project. I am getting these messages in nginx error.log. 2016/07/13 23:08:05 [info] 28306#0: *110027 client closed connection while waiting for request, client: 27.97.70.20, server: 0.0.0.0:80 Total number of…
Nithin Mohan
  • 182
  • 4
  • 13
2
votes
1 answer

Lapis not using values from config.moon

I'm following the guides on leafo.net/lapis to create a configuration file. My config.moon is in the top level folder of the app and looks like this config = require "lapis.config" config "development", -> port 5001 When I run lapis build or…
Samo
  • 8,202
  • 13
  • 58
  • 95
2
votes
1 answer

nginx lua not able to set headers before rewrite

I have a set of ip address in my redis server to be blocked. Now when a client makes a request, the request must be intercepted by nginx check if the remote_addr belongs to the blocked ip add a header if the ip is blocked then redirect to the…
Ravi
  • 31
  • 1
  • 4
2
votes
1 answer

nginx return 200 if rewrite_by_lua_block response header contains pattern

I need nginx to return 200 code on some location only if rewrite_by_lua_block response contains custom header with pattern (for google compute engine balancer healthcheck). I'm very newbie in lua, so any help's greatly appreciated.
d.ansimov
  • 2,131
  • 2
  • 31
  • 54
2
votes
1 answer

How would Tarantool be embedded inside OpenResty?

Openresty has an option for specifying the path to the LuaJIT. The NGXIN/Lua module uses co-routines for each request. However, Tarantool uses Fibers instead of Co-routines. Does this mean you would have to create a custom lua-nginx-module that…
dgo.a
  • 2,634
  • 23
  • 35
2
votes
1 answer

Openresty custom json access log

I would like to write JSON strings on every request into the access logs, so it would be easier to consume it later. I am using the print() exposed by Lapis/Openresty, however I would like to over ride the timestamp, log level and other information…
2
votes
0 answers

OpenResty rewrite_by_lua vs. rewrite_by_lua_file - syntax errors

I am using OpenResty Nginx, and have a snippet of Lua script in the Nginx conf. (sample below, but truncated for brevity). This works fine when it is in the nginx.conf file. rewrite_by_lua ' -- Load Memcached module local memcached =…
Benr77
  • 155
  • 1
  • 10
2
votes
1 answer

Why must we read the request body before doing a subrequest using OpenResty / nginx lua?

We are partly delegating nginx access control to a separate service, and we use access_by_lua_file and lua-resty-hawk and subrequests to do the authentication of the request. The docs say: You should always read the request body (by either calling…
Dobes Vandermeer
  • 8,463
  • 5
  • 43
  • 46
2
votes
1 answer

NGINX : Making two asynchronously calls to a backend server

I want to do the following using NGINX Module : Nginx receives a request, checks if it has the key to decode the request in the cache(custom) if YES, then decode request, obtain an ID from it and check if there is a value against this ID in a…
melwin_jose
  • 315
  • 3
  • 20
2
votes
2 answers

Limit requests frequency of each IP using NGINX & Lua

My goal is to prevent the high frequent request based on user IP, and i google the openresty and found it can be played with Lua. So i wrote the following script, i'm a newbie to Lua, could anyone give me some advice on this script, or even correct…
yunfeng.guo
  • 175
  • 1
  • 11