Welcome! Log In Create A New Profile

Advanced

How to rewrite write with proxy

Posted by misnet 
How to rewrite write with proxy
August 26, 2009 03:51AM
I want to resolve the problem of ajax cross domain by the rewrite or proxy. In apache,I use these:

<VirtualHost *:80>
ServerAdmin misnet@hotmail.com
DocumentRoot V:/workspace/webserver/wwwRoot
ServerName www.dkb.net.cn
ServerAlias *.dkb.net.cn
RewriteEngine on
[b]RewriteCond %{QUERY_STRING} ^url=http://(login|yj|mc|img).dkb.net.cn(.+)$
RewriteRule ^/doproxy$ http://%1.dnkb.net.cn%2 [P][/b]
</VirtualHost>

I want to migration from apache to nginx, but i can't migrate this part. My nginx.conf configuration below:

server{
listen 80;
root V:\workspace\webserver\wwwRoot;
server_name yj.dkb.net.cn mc.dkb.net.cn login.dkb.net.cn ;
access_log off;
error_log logs/tappy.error.log;
location ~ .*\.(php|phtml)?$ {
include fcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_intercept_errors on;
}
location /doproxy{
if ($query_string ~* "url=http://(login|yj|mc|news|img).dkb.net.cn/(.+)"){
set $psurl $2;
set $pshost $1;
[b]proxy_pass http://$pshost.dkb.net.cn$psurl;[/b]
}
}
}

When I run the [b]http://yj.dnb.net.cn/doproxy?url=http://login.dkb.net.cn/index/ajlogin[/b] in my broswer, nginx grenerated the error message below:

2009/08/26 15:48:47 [error] 3268#3256: *1 [b]no resolver defined to resolve login.dkb.net.cn[/b] index, client: 127.0.0.1, server: yj.dkb.net.cn, request: "GET /doproxy?url=http://login.dkb.net.cn/index/ajlogin HTTP/1.1", host: "yj.dnb.net.cn"



Edited 2 time(s). Last edit at 08/26/2009 03:53AM by misnet.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready