openresty / openresty/lua-nginx-module
[Question] ngx.execute doesn't work correctly (at least in my case)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
I am trying to add support for my FastCGI & ExpressJS pages using internal routes like
location ~ /@ExpressJS(/+)?(([a-zA-Z0-9\_\-]+(/+))+)? {
internal;
rewrite ^/@ExpressJS/(.*)$ /$1 permanent;
root /var/www/htdocs;
proxy_pass $scheme://127.0.0.1:$_proxy_port$request_uri;
proxy_set_header Host $http_host;
proxy_http_version 1.0;
proxy_ssl_server_name off;
# some directives for SSL and security related directives and cache
}
location ~ /@FastCGI(/+)?((([a-zA-Z0-9\_\-]+(/+))+)?([a-zA-Z0-9\-\_]+\.php))? {
internal;
rewrite ^/@FastCGI/(.*)$ /$1 permanent;
root /var/www/htdocs;
try_files $uri $request_uri =404;
fastcgi_pass 127.0.0.1:25680;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SERVER_PORT $balancer_port;
#fastcgi_param HTTP_VERSION 2.0;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param SERVER_PROTOCOL $server_protocol;
# some security related directives and cache...
}
-- some kind mechanism to handle routes dynamicaly : ExpressJS
ngx.exec("/@ExpressJS", ngx.var["request_uri"])
ngx.log(ngx.DEBUG, "#1 : " .. uri)
-- some kind mechanism to handle routes dynamicaly : FastCGI
ngx.exec("/@FastCGI", ngx.var["request_uri"])
ngx.log(ngx.DEBUG, "#1 : " .. uri)
I am using internal routes to catch handle fastcgi requests after being routes through Lua based mechanism (which is almost working perfectly except for Query arguments) and I tried opening phpMyAdmin, but it is not fully working because of some kind of issues with the Query Arguments which is not respected and i tried many times to solve it like
ngx.exec("/@FastCGI" .. ngx.var["uri"], ngx.var["args"])
but it results in *1 rewrite or internal redirection cycle while internally redirecting to "/@FastCGI/phpmyadmin/index.php"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names ngx.exec and shows Lua snippets plus NGINX locations for ExpressJS and FastCGI, but no repository file or test. Start by checking ngx.exec's documented URI and argument handling, then reproduce the shown internal-redirection cycle; done means query arguments are preserved without triggering the cycle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, lua, nginx
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100