How to map URL to port and modified URL?

最后都变了- 提交于 2019-12-13 01:12:26

问题


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'"


回答1:


It is easily accomplished using Nginx:

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


来源:https://stackoverflow.com/questions/22635019/how-to-map-url-to-port-and-modified-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!