Welcome! Log In Create A New Profile

Advanced

two small questions about embedded perl

Sven 'Darkman' Michels
December 14, 2010 04:40PM
Hi there,

i just got two small questions about using embedded perl:
first: i would like to "rewrite" the request using a perl module, since the
rewrite is a bit more than just regexp. I thought that using "internal_redirect"
is the right way to do, but i don't get working.
The module looks like:
package testpackage;
use nginx;
use ...;

sub handler {
$r = shift;
.. some stuff
if($ok) {
$r->internal_redirect("/$uri");
return OK;
}
}

i tried with and without return, seems to make no difference...

nginx config looks like:
....
http {
perl_require module.pm;
....
server {
...
location /folder {
perl testpackage::handler;
# proxy_pass stuff
}
location / {
proxy_pass stuff
}
}
}

i did put some proxy stuff into the location /folder, after the module, and
some into location /, but the best i got was a unedited call to the backend.
The module itself got called, usually i get nothing returned (state 200 but
no data). If i return other codes in the module, they work as expected. So
the module itself is working, just the rewrite/proxy stuff isn't.

Next question: is it possible to pass vars to the module? like having a special
option per location which is passed to the module instead of using a couple
of modules...

Thanks and regards,
Sven

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

two small questions about embedded perl

Sven 'Darkman' Michels December 14, 2010 04:40PM

Re: two small questions about embedded perl

Igor Sysoev December 14, 2010 05:04PM

Re: two small questions about embedded perl

Sven 'Darkman' Michels December 14, 2010 05:32PM

Re: two small questions about embedded perl

Igor Sysoev December 14, 2010 05:44PM

Re: two small questions about embedded perl

Sven 'Darkman' Michels December 15, 2010 12:48AM

Re: two small questions about embedded perl

Sven 'Darkman' Michels December 16, 2010 04:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready