HTTP Proxy Configuration

Patrick Stadler edited this page Jul 4, 2013 · 13 revisions

Apache HTTPD

AddDefaultCharset UTF-8
Options +MultiViews
RewriteEngine On
RewriteRule http-bind/ http://yourhost.com:5280/http-bind/ [P]

nginx

location /http-bind/ {
    proxy_pass  http://yourhost.com:5280/http-bind/;
    proxy_buffering off;
    tcp_nodelay on;
}

lighttpd

proxy.server = (
    "http-bind/" =>
        ( (
            "host" => "127.0.0.1",
            "port" => 5280
        ) )
)

IIS

  • Application Request Routing Cache -> enable proxy checked

  • URL Rewrite module

     1. create blank inbound rule
     2. Name it.
     3. Requested URL drop: Matches the pattern selected
     4. Using drop: Regular expressions selected
     5. Pattern: http-bind/ (ignore case check checked)
     6. No conditions or server variables(unless you know what you doing)
     7. Action type: Rewrite
     8. Rewrite URL: http://yoursite:port/http-bind/
    

p.s. When initiating Candy chat remember to use 'http://yoursite/http-bind/' for service,

Node.js

Write a simple HTTP proxy for node.js. Check out candy-node for a complete solution.

var http = require('http');

http.createServer(function(request, response) { 

    if(request.url === '/http-bind/') {
        var proxy_request = http.request({
            host: 'yourhost.com',
            port: 5280,
            path: '/http-bind/',
            method: request.method
        });

        proxy_request.on('response', function(proxy_response) {
            proxy_response.on('data', function(chunk) {
                response.write(chunk, 'binary');
            });         
            proxy_request.on('end', function() {
                response.end();
            });
            response.writeHead(proxy_response.statusCode, proxy_response.headers);
        });

        request.on('data', function(chunk) {
            proxy_request.write(chunk, 'binary');
        });
        request.on('end', function() {
            proxy_request.end();
        });
    }

}).listen(80);