Part 1 · নেটওয়ার্কিং 📖 ১১ মিনিট পড়া 📝 ২০টি কুইজ

Proxy — মধ্যস্থতাকারী সার্ভার

Forward proxy ও Reverse proxy — দুটো ভিন্ন উদ্দেশ্য, একই নাম।

📝 কুইজে যান

আপনি একটি বিদেশি দূতাবাসে কাগজপত্র জমা দিতে যাচ্ছেন। সরাসরি না গিয়ে — একজন এজেন্ট-এর মাধ্যমে যাচ্ছেন। এজেন্ট আপনার পক্ষ হয়ে কথা বলছেন। এটাই Forward Proxy। আবার সেই দূতাবাসে — receptionist সবার সাথে আগে কথা বলে ভিতরে কোন ডিপার্টমেন্টে পাঠাবেন ঠিক করেন। এটাই Reverse Proxy

Proxy কী?

Proxy একটি মধ্যস্থতাকারী সার্ভার যা client এবং destination server-এর মাঝে বসে — অনুরোধ ও উত্তর forward করে।

Forward Proxy

Forward Proxy client-এর পক্ষ থেকে কাজ করে। Client কে hide করে।

Client → Forward Proxy → Internet → Server

ব্যবহার

  • Privacy/Anonymity: Server client-এর real IP জানে না।
  • Content filtering: Office-এ Facebook block — corporate proxy filter।
  • Geo-bypass: অন্য দেশের IP দেখিয়ে content access।
  • Caching: Office-এর সবাই Wikipedia ব্যবহার করলে — proxy এক copy রাখে।
  • Logging: কর্মীরা কোথায় browse করছে track।

উদাহরণ

  • VPN — এক ধরনের forward proxy।
  • School/office network filter।
  • Squid — popular open-source forward proxy।

Reverse Proxy

Reverse Proxy server-এর পক্ষ থেকে কাজ করে। Server-কে hide করে।

Client → Internet → Reverse Proxy → Backend Servers

ব্যবহার

  • Load balancing: একাধিক backend-এ traffic বিতরণ।
  • SSL termination: Reverse proxy SSL handle করে; backend plain HTTP।
  • Caching: Static asset cache (Varnish, NGINX)।
  • Compression: Gzip/Brotli proxy-তে।
  • Security: Backend IP hide, DDoS absorb, WAF।
  • API Gateway: Microservice-এ routing।
  • A/B testing: ১০% user-কে নতুন version-এ পাঠানো।

উদাহরণ

  • NGINX: সবচেয়ে জনপ্রিয় reverse proxy।
  • HAProxy: High-performance LB + proxy।
  • Apache Traffic Server
  • Cloudflare: Global reverse proxy + CDN।
  • AWS ALB/CloudFront: Managed reverse proxy।

Forward vs Reverse Proxy

Forward Proxy

  • Client-এর পক্ষে কাজ
  • Client-কে hide করে
  • Outbound traffic control
  • Use: VPN, content filter
  • Server জানে না real client কে

Reverse Proxy

  • Server-এর পক্ষে কাজ
  • Server-কে hide করে
  • Inbound traffic control
  • Use: LB, SSL, security
  • Client জানে না real server কোথায়

Reverse Proxy বনাম Load Balancer

প্রায় সব reverse proxy LB হিসেবেও কাজ করতে পারে। পার্থক্য:

  • Reverse Proxy: এক backend থাকলেও কাজ করে — caching, SSL, security।
  • Load Balancer: multiple backend-এ traffic distribute করাই মূল কাজ।
  • Modern tool (NGINX) — দুটোই করে।

বাস্তব উদাহরণ

  • Cloudflare: Global reverse proxy — সব Cloudflare-protected সাইটের সামনে বসে।
  • NGINX in front of Node.js: Node app পেছনে, NGINX SSL ও static file handle করে।
  • VPN (NordVPN, ProtonVPN): Forward proxy যা IP hide করে।
  • School wifi-এ Facebook block: Forward proxy filter।

সাধারণ ভুল ধারণা

  1. "Proxy ও VPN একই": VPN একটি forward proxy + encryption + tunneling। Proxy শুধু forward।
  2. "Reverse proxy = load balancer": না, LB একটি reverse proxy-র subset।
  3. "Proxy slow করে": Caching ও SSL termination থাকলে proxy সিস্টেম-কে fast করে।

Best Practices

  • Modern সিস্টেমে reverse proxy বাধ্যতামূলক — backend কে public থেকে আলাদা রাখুন।
  • SSL termination proxy-তে — backend resource বাঁচান।
  • Health check enable — failed backend skip।
  • Logging গুরুত্বপূর্ণ — প্রতি request audit trail।
  • Rate limiting proxy layer-এ অনেক কার্যকর।

📌 চ্যাপ্টার সারমর্ম

  • Proxy = client ও server-এর মধ্যস্থতাকারী।
  • Forward proxy client-এর পক্ষে; Reverse proxy server-এর পক্ষে।
  • VPN একটি forward proxy। NGINX/Cloudflare reverse proxy।
  • Reverse proxy SSL, LB, caching, security সব handle করে।
  • Modern সিস্টেমে reverse proxy অপরিহার্য।