Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] ngx.execute doesn't work correctly (at least in my case) #2384

Open
Zorono opened this issue Dec 8, 2024 · 0 comments
Open

[Question] ngx.execute doesn't work correctly (at least in my case) #2384

Zorono opened this issue Dec 8, 2024 · 0 comments

Comments

@Zorono
Copy link

Zorono commented Dec 8, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant