Questions tagged [lua]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

imapfilter - does a mailbox exist

Sorry bit of a imapfilter 101 I'm afraid ... I'm trying to do something quite simple. I seems to be making heavy weather of it, feels like there's a simple solution. I want to process inbox into new ...
GraemeV's user avatar
0 votes
0 answers
41 views

Nginx force revalidate stale cache after timeout

There is a case in Nginx reverse proxy cache usage, when; proxy_cache_background_update on; proxy_cache_use_stale updating; For the same URL if a single response comes from the upstream with max-age, ...
Rockybilly's user avatar
3 votes
0 answers
381 views

Nginx Lua module for redirecting based on proxy and access headers

In nginx I want to redirect user based on access and proxy headers. When I put it to the response header, they are shown correctly in the browser. But when using in lua to redirect with an if it does ...
Trouble's user avatar
  • 31
0 votes
0 answers
48 views

Writing rules for rspamd to filter by email name and fuzzy score

The situation is as follows. There is whitelisted domain(ours) and we receive letter with the same addresses as ours but with phishing content. Since it's whitelisted it gets the low spam score. Fuzzy ...
Yolo Yolovich's user avatar
0 votes
1 answer
341 views

PowerDNS lua ifportup Failing

I'm having a problem getting a PowerDNS ifportup lua record working. I'm new to PowerDNS and know DNS relatively well. I'd appreciate if anyone could point out where I'm going wrong here. Background - ...
SpecNon's user avatar
1 vote
0 answers
191 views

SOAPUI What causes "error in msg parsing: xml was empty, didn't parse!"

Currently, I have a structure which takes a SOAP request, fires the request at a reverse proxy (a script written in Lua) which takes a copy of the SOAP request and then passes that to the webserver, ...
codinator's user avatar
0 votes
0 answers
244 views

Pass on SOAP request body through a reverse proxy

Im trying to implement a reverse proxy which takes in a SOAP request, saves the SOAP body message (Envelope, header, body etc.). I would then like to change some of the content of the SOAP request and ...
codinator's user avatar
0 votes
0 answers
498 views

Errors while starting Nginx server after the successfull compilation of Lua modules

I have compiled my Nginx package using lua module. Though the compilation was successful but I am getting the below error while starting the nginx server : nginx: [warn] lua_load_resty_core is ...
RAGHU.K.J Ram's user avatar
0 votes
1 answer
466 views

Nginx calculated log variables using lua

I'm trying to get Nginx (running as a Kubernetes ingress controller) to log in milliseconds rather then seconds. (This is so we can ingest the logs into our existing Elasticsearch system, which ...
Mark's user avatar
  • 165
0 votes
0 answers
26 views

How to encode url in haproxy [duplicate]

I am new to haproxy and I wanted to know the best way to encode the URL in haproxy. http-request redirect code 302 location https://testservice.com/login?service=abc&redirect_uri=https://login....
Mahesh G's user avatar
  • 111
1 vote
0 answers
233 views

Lua script does not close Nginx although ngx.close() defined

I am running a docker with lua-nginx image. In my Nginx conf file I call the lua script from server { } section: server { listen 80; server_name _; location /payload { content_by_lua_file ...
jrz's user avatar
  • 141
2 votes
0 answers
942 views

Lunajson not found in lua 5.2.3

I have installed lunajson with luarocks. When I attempt to use the module I keep getting the error below. I am just trying to decode a website that responds back with some json. The OS is running ...
user2236794's user avatar
0 votes
1 answer
1k views

Is it possible to avoid chunked transfer on lua nginx during body_filter_by_lua_block?

Let's say we want to change a response from a upstream, what we can do is to use Lua+nginx on the body_filter_by_lua_block phase, here's a snippet of that. server { listen 8181; location /...
Leandro Moreira's user avatar
0 votes
2 answers
3k views

Nginx rewrite/return phase order

I know there are Nginx phases. Why does the following snippet deliver the "200 Host: example.com" instead of forwarding to Google? What would be a generally valid workaround to evaluate Lua ...
uav's user avatar
  • 564
0 votes
1 answer
953 views

Build LUA as dynamic Nginx module

I have found that to use LUA with Nginx I need to either: use OpenResty platform: https://openresty.org/en/installation.html pay getpagespeed subscription to fetch the module RPM build Nginx with LUA ...
Leos Literak's user avatar
1 vote
2 answers
6k views

How to install nginx mod lua on Amazon Linux 2?

I have an Amazon Linux 2 machine. I have installed NGINX with amazon-linux-extras install nginx1.12 How can I install nginx-mod-http-lua? I have tried: yum search lua and no packages are listed ...
Rich's user avatar
  • 744
1 vote
1 answer
3k views

Lua missing socket.http module

I am using Lua with HAProxy. I have set LUA_PATH and LUA_CPATH as the following: LUA_PATH=/usr/bin/lua;/usr/bin/lua5.3;/usr/share/lua/5.3/ltn12.lua;/usr/share/lua/5.3/mime.lua;/usr/share/lua/5.3/...
Abrar Hossain's user avatar
2 votes
0 answers
2k views

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; ...
Morph's user avatar
  • 21
4 votes
2 answers
14k views

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 ...
jedelvalle's user avatar
2 votes
2 answers
14k views

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 ...
Joshua Rajandiran's user avatar
1 vote
0 answers
160 views

rescore spam corpus with rspamd

I recently tried to rescore my spam/ham corpus with rspamds rescoring mechanism (see the example in "Corpus test and rescore tool"), but unfortunately this ends in a runtime error. My current minimal ...
tr9sh's user avatar
  • 231
2 votes
1 answer
16k views

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 { ...
Jakov Sosic's user avatar
  • 5,277
2 votes
0 answers
78 views

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 ...
Bogdan Lashkov's user avatar
1 vote
1 answer
3k views

Unable to read a file and returns its result nginx

Using lua-nginx-module. And I'm unable to accomplish a thing wherein I'm want to modify the mtime of a file(touch.txt). I tried using .. os.execute("touch /app/directory/touch.txt") and this ...
Viren's user avatar
  • 181
0 votes
0 answers
1k views

Configuration dnsdist

Trying to install PowerDNS 4.1 Authoritative at 127.0.0.1:5300 Recursor at 127.0.0.1:5301 Dnsdist config as in documentation But get an error: # dnsdist -C dnsdist.conf Fatal Lua error: Unknown ...
Roman Bogachev's user avatar
0 votes
1 answer
711 views

nginx, lua and response time

I have an nginx loadbalancer which just proxies requests to a few upstream servers. Now, what I would like to do is: For one out of ten requests, I want to measure the response time of nginx (in ...
Jeroen Jacobs's user avatar
2 votes
0 answers
634 views

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 ...
Dilip's user avatar
  • 139
2 votes
0 answers
924 views

"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;...
Ciaran's user avatar
  • 21
2 votes
1 answer
3k views

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" ...
Madhur Ahuja's user avatar
2 votes
1 answer
4k views

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,...
Markus A.'s user avatar
  • 419
3 votes
1 answer
2k views

Passthrough captured request in nginx with lua

I'm doing something like this: location /foo { content_by_lua_block { local reqType = ngx.var.request_method if reqType == "POST" res = ngx.location....
IAmJulianAcosta's user avatar
0 votes
1 answer
537 views

nginx geotargeting and proxpass

I have a little issue with my Nginx config prototype The Scenario is following: website visitor will visit example.com. Nginx is read out with GeoIP the current location and accept language header ...
Tomcat666's user avatar
0 votes
1 answer
2k views

Blocking a request with ModSecurity and lua script

I have web traffic flowing through ModSecurity. Within the ModSecurity configuration I am calling a Lua script that is running some simple analysis on the arguments of request string. Specifically, ...
Futh's user avatar
  • 17
1 vote
1 answer
124 views

Squid3 URLrewrite - Unable to configure

I have Squid3-3.4.8 on Debian Wheezy. It is performing caching duty. I just want to replace one jpg url to another URL in my local server or outside. I have tried solutions like Volta, squidred, ...
user359944's user avatar
-1 votes
3 answers
2k views

PowerDNS: Is it possible to send different results based on server IP used by the client?

I would like to setup a recursive DNS server with multiple IPs all on the same PowerDNS server. Let's say: 8.8.8.1 8.8.8.2 8.8.8.3 8.8.8.4 I was wondering how I could send different responses based ...
plz's user avatar
  • 11
1 vote
0 answers
1k views

Lua flavored Nginx rewrite or internal redirection cycle

I'm new both to nginx and lua. I'm trying to follow this tutorial http://leafo.net/posts/creating_an_image_server.html#installation_requirements but for the life of me I can't get the nginx.conf right....
U r s u s's user avatar
  • 121
1 vote
1 answer
317 views

Fixing syntax errors in lighttpd.conf?

lighttpd newbie here... We're trying to set up lighttpd to host a local django app, kiosk-style. We intend to use wsgi for this, but we're having trouble figuring out the syntax for lighttpd's config ...
Tom Corelis's user avatar
1 vote
1 answer
814 views

how to configure http request pipeling using wrk?

I am trying to load test nodejs helloworld, which is running on system 1 at http://10.20.10.10:5000 and I want to pipeline http requests from system 2. wrk takes a script as a parameter. I am ...
RedFox's user avatar
  • 111
4 votes
1 answer
4k views

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 ...
Terion's user avatar
  • 163
2 votes
1 answer
15k views

Nginx how to run shell script on page load via lua module os execute and then serve directory listing?

So I have a bash script that I want to execute/run on each "page load" of url so that it will modify (creating symlinks) to a /public/html/ folder that I want the server to then serve. The problem ...
htfree's user avatar
  • 481
0 votes
1 answer
508 views

High %sys utilization in Nginx cache node

We set up Nginx with Lua (openresty bundle) to be a local caching node to our file sharing server, we seperated files to chunks "50MB each" (by this method) and store them in cache to increase its ...
Ali Alnakeab's user avatar
-2 votes
1 answer
176 views

How do you "prevent powerful accounts from being used on unauthorized systems"? [closed]

I was browsing through Microsoft's Best Practices for Securing Active Directory and saw the chart linked which includes some of the best practices included in the document, rated by importance. At ...
cutrightjm's user avatar
1 vote
1 answer
4k views

Nginx proxy_pass based on file extension and query string

I need to proxy_pass static assets (.js .css) based on file extension and query strings. For example: domain.com/foo.css - go to upstream1 domain.com/foo.css?V=1234 - go to upstream2 Reason is I ...
Radoslav Stefanov's user avatar
0 votes
1 answer
289 views

how to install lafilefixer in ubuntu

I am getting following error while installing freeswitch on Ubuntu. libtool: link: cannot find the library /usr/src/freeswitch/libs/apr-util/xml/expat/lib/libexpat.la' or unhandled argument/usr/src/...
Saghar's user avatar
  • 103
6 votes
2 answers
2k views

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 ...
user3786834's user avatar
0 votes
1 answer
2k views

Can't figure out how to get started with powerdns-recursor lua scripting

I have a server (Ubuntu 12.04) where I run powerdns-recursor. I'm trying to add some logic to certain requests and have got my target set on lua scripting for powerdns. I don't seem to be able to ...
azzid's user avatar
  • 133
3 votes
1 answer
1k views

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 ...
Greg Dubicki's user avatar
  • 1,321
0 votes
1 answer
770 views

Nginx using mysql result as variable to be used in headers more module

Without going into too much detail we have a requirement for the following: a) Query a simple single column, single row result from mysql. b) Use this variable as part of a more headers module, ...
anonymous-one's user avatar
0 votes
1 answer
704 views

Running WSAPI on ngninx via FastCGI

Using Lua 5.2 with wsapi 1.6-1 and wsapi-fcgi 1.6-1 installed via luarocks, I have the following nginx configuration: server { listen 127.0.0.1:8080; server_name localhost; location / { ...
petsagouris's user avatar
2 votes
2 answers
5k views

How to improve call quality freeswitch?

Currently I have a system that makes use of FreeSWITCH for outbound calls via SIP External with flowroute and works well, but some users complain about the quality of the call. The system is running ...
Sansa's user avatar
  • 21