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>
DocumentRoot V:/workspace/webserver/wwwRoot
ServerAlias *
RewriteEngine on
[b]RewriteCond %{QUERY_STRING} ^url=http://(login|yj|mc|img)$
RewriteRule ^/doproxy$ [P][/b]

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

listen 80;
root V:\workspace\webserver\wwwRoot;
server_name ;
access_log off;
error_log logs/tappy.error.log;
location ~ .*\.(php|phtml)?$ {
include fcgi.conf;
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)"){
set $psurl $2;
set $pshost $1;
[b]proxy_pass http://$$psurl;[/b]

When I run the [b][/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[/b] index, client:, server:, request: "GET /doproxy?url= HTTP/1.1", host: ""

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: 338
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