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/

385 questions
67
votes
1 answer

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
  • 671
  • 1
  • 4
  • 3
17
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
  • 7,972
  • 22
  • 92
  • 184
9
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
  • 107,447
  • 124
  • 346
  • 512
6
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
  • 865
  • 1
  • 12
  • 26
6
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
  • 8,472
  • 13
  • 58
  • 111
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,049
  • 1
  • 17
  • 38
5
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…
5
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
  • 105
  • 7
5
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
  • 181
  • 1
  • 2
  • 12
4
votes
1 answer

Authenticate websocket with keycloak through openresty

Currently I have a working solution with following components: Webserver with custom application Openresty with lua Keycloak This allows me to authenticate using keycloak. Because my webserver also exposes a websocket host, I would like to…
4
votes
0 answers

how to rewrite response based on request body content in nginx?

I have requirement where i need to have a rewrite the response with static context in nginx based on content from the request body say "fruit":"apple", The nginx location with rewrite config as mentioned below, o tried referring to nginx…
4
votes
1 answer

Nginx Docker AWS, Nginx is not able to resolve 127.0.0.11 in multi container

What I am working on: nginx- openresty with mecached and docker-compose. from nginx I am able to connect memcached container by specifying resolver = 127.0.0.11, in docker compose it working file. But when I am deploying it on AWS multi container…
4
votes
1 answer

Is it possible to consolidate multiple responses and send one response in NGINX

I have Nginx/openresty and some other services running on one VM. Basically VM accepts requests on Openresty and then openresty forwards requests to appropriate service. e.g. below requests getting forwarded to ServiceA, ServiceB and ServiceC…
Yogi_NE
  • 167
  • 16
4
votes
1 answer

Kong API gateway v0.11.0 upstream_url

We are trying to set up a plugin that depends on the headers of the request, proxy it to an specific host. Ex. curl -H 'Env: foo' http://127.0.0.1:8000/poc -> https://foo.example.com/poc curl -H 'Env: bar' http://127.0.0.1:8000/poc ->…
4
votes
1 answer

Share a LUA variable across requests in Lua-Resty (openresty)

I'm using OpenResty with lua-resty; and obviously for each request the program has its own variables. To share simple strings or configurations across requests I currently use lua-shared-dict. But, if I need to share and maintain a big variable…
Carmine Giangregorio
  • 833
  • 2
  • 13
  • 32
1
2 3
25 26