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

Nginx startup prompt [emerg] no "events" section in configuration

In the X-WAF deployment, you need to create a new nginx configuration file. However, when testing the nginx configuration, an error is found and nginx cannot be started. I refer to http://blog.51cto.com/14071176/2318054,I did it step by step…
Dora
  • 1,261
  • 2
  • 6
  • 3
23
votes
1 answer

Unable to use environment variables in Lua code

I have some Lua code, which I use in my openresty nginx.conf file. This Lua code contains such lines: ... local secret = os.getenv("PATH") assert(secret ~= nil, "Environment variable PATH not set") ... Just for testing reasons I tried to check if…
Jacobian
  • 10,122
  • 29
  • 128
  • 221
12
votes
2 answers

NGINX rate limitting by decoded values from JWT token

I have a question regarding NGINX rate limiting. Is it possible to do rate limiting based on the decoded value of JWT token? I cannot find any information like this in the docs. Or even if there is a way of doing rate limiting by creating pure…
Marcin Majewski
  • 1,007
  • 1
  • 15
  • 30
10
votes
2 answers

Openresty: Make an http call with lua and return its parsed result

My problem I am using openresty to build a simple server. Upon calling this server, it should make another call to a different server, fetch a JSON result, process it and return the parsed result. The server should be implemented in openresty for…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
10
votes
2 answers

nginx monitoring response from upstream server

I have a reverse proxy setup with nginx. Client ------> Nginx ------------------------------------> Backend Server <------ <----------------------------------- (I want to see the requests here) How can I log the…
Brian
  • 12,145
  • 20
  • 90
  • 153
6
votes
0 answers

xxxx could not be resolved (110: Operation timed out)

When invoking other services through HTTP in my app, parsing DNS is occurring every time. At the beginning, parsing DNS was normal and there was no timeout, but after a while, parsing DNS timeouts became more and more. Take out the timeout domain…
james
  • 71
  • 3
6
votes
2 answers

Openidc with Keycloak error uthenticate(): request to the redirect_uri_path but there's no session state found, client

I am using Openresty as a server. I have the configuration file of the nginx as per the https://eclipsesource.com/blogs/2018/01/11/authenticating-reverse-proxy-with-keycloak/. I am getting following error "openidc.lua:1053: authenticate(): request…
6
votes
2 answers

How come I cannot set multiple cookies

I'm trying to set multiple cookies, but it's not working: if type(ngx.header["Set-Cookie"]) ~= "table" then ngx.header["Set-Cookie"] = {} end table.insert(ngx.header["Set-Cookie"], "Cookie1=abc; Path=/") table.insert(ngx.header["Set-Cookie"],…
Dat Boi
  • 115
  • 1
  • 7
6
votes
4 answers

How to dynamically add an upstream in Nginx?

I mean add an upstream but not a server in an upstream. That means I don't have an upstream block like: upstream backend { # ... } I want create an upstream block dynamically. That is something like: content_by_lua_block { …
XadillaX
  • 191
  • 1
  • 2
  • 13
6
votes
2 answers

docker unit test setup

I want to setup a unit test environment for my product. I have a web application build on nginx in Lua which use mysql and redis. I think docker will be good for this although i am new to docker. My application runs on centos server (production…
Nishant Kumar
  • 2,199
  • 2
  • 22
  • 43
5
votes
1 answer

relation between rewrite uri and set variable statements in nginx

Im trying to find what is the relation between rewrite statement in nginx location block and set variable statement inside location block. Why im asking is because of different behaviour in below 2 cases what does not work- getting http 500 as url…
5
votes
2 answers

Why is nginx claiming there's no terminating semicolon in my `rewrite` statement?

I'd like to redirect a URL to a Django platform (via uwsgi) if and only if a cookie exists. Failing that, I need to defer execution to the content_by_lua plugin. Below is my attempt at such logic: location ~*…
Louis Thibault
  • 20,240
  • 25
  • 83
  • 152
5
votes
2 answers

How do I use MySQL for dynamic doc root with Nginx?

I've been trying to find out a way to first capture environment variable HOSTNAME and then use a MySQL query to fetch and return back to the Nginx conf the document root for our vhosts. We use them for dynamic doc roots currently in Apache but are…
user2782387
  • 101
  • 1
  • 6
4
votes
1 answer

Nginx access_by_lua_block not executed in case of 3XX redirects

I am using the access_by_lua_block in my nginx configuration to add/modify custom request headers (let's say ngx.req.set_header("foo", "bar")). I am accessing these headers within the header_filter_by_lua_block as ngx.var["http_foo"] just before…
4
votes
2 answers

How do i can split nginx error.log by date?

I want to split the nginx error.log by date, but not work here is my code : if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") { set $year $1; set $month $2; set $day $3; } access_log logs/access.log.$year$month$day main; error_log …
HEXB
  • 61
  • 1
  • 7
1
2 3
31 32