Questions tagged [lua]

Lua is a lightweight, embeddable, multi-paradigm, dynamically-typed programming languague.

55 questions
8
votes
1 answer

nginx lua: os.execute waitpid() failed (10: No child processes)

So, I'm trying to execute a script on every request. I know how that sounds, this is for development environment. I've added this to my nginx config access_by_lua_file "/opt/nginx/git-magic.lua"; git-magic.lua contains local status =…
Andrei Serdeliuc
  • 905
  • 5
  • 14
  • 26
6
votes
2 answers

Installing additional LUA modules into Redis

I'm trying to get Redis to allow EVAL (http://redis.io/commands/EVAL) to make HTTP requests. Two modules: LuaCURL and Luasocket give this ability. The Redis source code has a directory with additional modules (such as cjson)…
user3786834
  • 127
  • 8
4
votes
1 answer

Nginx - Empty response in error page with proxy_pass

Task: nginx config for reverse proxy to docker containers with dynamic lookup and caching. Process workflow: check cache. if upstream found — proxy if not found — request it, cache and proxy if found but cache is invalid — clear cache and run…
Terion
  • 163
  • 1
  • 6
4
votes
1 answer

Nginx (openresty) generating random numbers

I have openresty set up on a server (nginx bundle which includes the lua module) and I'm trying to create a script which has specific odds of setting a cookie on a user's browser. My code looks like this: location =/index.php { set…
Mediocre Gopher
  • 803
  • 1
  • 13
  • 24
3
votes
2 answers

NGINX - OpenResty - How to reverse proxy a call to 2 different servers based based on a string?

I'm trying to configure NGINX/OpenResty to proxy SOAP calls to 2 different servers based on a string present on the SOAP request. What I'm able to do: I am able to proxy requests to 2 different servers based on the path the SOAP client is…
jedelvalle
  • 31
  • 1
  • 1
  • 2
3
votes
1 answer

Sending data to statsd does not work in some locations with content_by_lua_file

Before Until recently I used nginx 1.4.x with zebrafishlabs/nginx-statsd as a reverse proxy for openresty (yes, I know, nginx behind nginx is stupid - keep reading please) with the following location nginx configuration: location /track { …
Greg Dubicki
  • 1,239
  • 1
  • 17
  • 33
3
votes
2 answers

Nginx & Lua: Hacks, optimizations & observations

Following this post on using Lua to increase nginx’s flexibility and in reducing load on the web stack I am curious to know how people are using Lua to enhance nginx’s capability. Are there any notable hacks, optimizations & observations using…
Quintin Par
  • 4,373
  • 11
  • 49
  • 72
2
votes
0 answers

Docker. How to get environment variable in nginx access_by_lua_file lua script

I have nginx in a docker container, where FORWARD_LOG env variable has value 1. In nginx.conf: env FORWARD_LOG; My server config: server { listen 80 default_server; server_name nginx; location / { #resolvers …
Morph
  • 21
  • 2
2
votes
2 answers

Permission denied when Nginx tries to write image file

I'm using Nginx for a Linux server and I have this folder /usr/local/openresty/nginx/webfolder/img where I want nginx to save my uploaded image files. So, this is what I did: 1) I changed the owner of the directory to www-data user in www-data…
Joshua Rajandiran
  • 123
  • 1
  • 1
  • 4
2
votes
1 answer

How to properly use ENV variables in Nginx config?

I want to pass the RAILS_ENV env variable to nginx and use it to set the value for the rails_env directive. I can read the value of the variable from the environment with LUA module: location @app { set_by_lua $env_rails_env 'return…
Jakov Sosic
  • 5,267
  • 4
  • 24
  • 35
2
votes
0 answers

How to select the preferred file transport method?

I have a problem, as I think, with my prosody configuration: When I am sending files (for example photos) bigger than ~2 or 3 megabytes (as I established experimentally) using Converstions 2.* version (android IM app) it transfers these files using…
Bogdan Lashkov
  • 141
  • 1
  • 1
  • 8
2
votes
0 answers

Dynamic HTTP reverse proxy in nginx

Im trying to do the following where: nginx should accept incoming requests from clients and rewrite/proxy them to dynamic upstreams as instructed by a "dynamic routing endpoint" The dynamic routing endpoint is an external HTTP API endpoint that…
Dilip
  • 139
  • 2
2
votes
0 answers

"ssl_protocols" directive is not allowed here - How to make conditional

I have a number of servers in nginx that are using my configuration file, however I need to be able to add an if or a variable to change ssl_protocols TLSv1 TLSv1.1 TLSv1.2; to ssl_protocols TLSv1; is this possible? I have tried an if statement…
Ciaran
  • 21
  • 1
2
votes
1 answer

NGINX + Lua : set cache key based on upstream Response headers

I am trying to control the cache key using the upstream response header field value. The header field in questions is Common-Api in the configuration below. I keep getting nginx: [emerg] unknown "ck" variable . Any idea what I am doing wrong? …
Madhur Ahuja
  • 283
  • 2
  • 5
  • 17
2
votes
1 answer

Returning HTTP status 204 for GET /generate_204 using uhttpd?

To deal with the Android captive portal detection for my specific setup, I need to return an HTTP status code 204 whenever I get a GET request for /generate_204. I currently use uhttpd as my webserver, so I'm wondering whether this is possible to do…
Markus A.
  • 419
  • 7
  • 18
1
2 3 4