An Nginx proxy pass example

As a quick note to self, as I configure my “Mini-Me” application, which has a client written with Sencha Touch 2, and a Play Framework server, I used this Nginx proxy pass configuration:

# mount the minime client, which is served up by apache
location /client {
    proxy_pass        http://minimeclient:8888/;
    proxy_set_header  X-Real-IP $remote_addr;

# mount the minime server, which is served up by the play framework console
location /server/notes {
    proxy_pass        http://minimeserver:9000/notes;
    proxy_set_header  X-Real-IP  $remote_addr;

The Sencha client is being served by Apache, and the server is a normal Play Framework server. (The X-Real-IP stuff isn’t 100% necessary.)

Another “proxy pass” example

As another example, I used this Nginx proxy_pass configuration to set up an application running on port 5150 of the localhost. In this case the users’ browser connects to the public Nginx server on port 80, and Nginx passes the information shown back to the application that’s running on port 5150:

location /uri/to/myapp {
   proxy_pass       http://localhost:5150/myapp;
   proxy_set_header X-Real-IP          $remote_addr;
   proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
   proxy_set_header Host               $http_host;
   proxy_set_header X-Forwarded-Host   $host;
   proxy_set_header X-Forwarded-Server $host;
   # 'off' is default; prevents changes to the Expires and Cache-Control headers
   #expires off;

“There is only Now.”
~ Eckhart Tolle