How to map URL to port and modified URL?

forwarding, lighttpd, nginx, port, url

Solution

It is easily accomplished using Nginx:

    location /api/ {
            rewrite   ^/api(/.*)$ $1 break;
            proxy_pass http://localhost:9000;
    }

Problem

How do I map www.somesite.com/api(.*) to www.somesite.com/$1:9000? (I need to map /api to Play framework application running @ port 9000) I did the following: ``` $HTTP["url"] =~ "^/api" { proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 9000 ) ) ) } ``` This gets me to somesite.com/api:9000 when I go to somesite.com/api, and I get "Action not found: For request 'GET /api'"

Original source