Skip to main content

Reverse Proxy

Basic

server {
  listen 80 ssl;
  server_name TEST.LAB.LOCAL;
  
  location / {
    proxy_pass http://localhost:8080/examples;
  }
}

Set Nginx proxy header values

server {
  listen 80;
  server_name TEST.LAB.LOCAL;
  
  location / {
    proxy_pass http://localhost:8080/examples;
    proxy_buffering off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
  }
}

With SSL

server {
  listen 443 ssl;
  server_name TEST.LAB.LOCAL;

  ssl_certificate /path/to/ssl_certificate.crt;
  ssl_certificate_key /path/to/ssl_private_key.key;

  location / {
    proxy_pass http://localhost:8080/examples;
    proxy_buffering off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
  }
}
}