Reverse proxy with connection pool using user session endpoint?

I am currently using nginx as a proxy to allow pooling into a database database service that uses basic HTTP authentication when connecting:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
    worker_connections 10000;
}

http {
  client_max_body_size 0;
  sendfile        on;

  upstream cloudant_backend {
    server <hostname>.cloudant.com:443;
    keepalive 64;
  }

  server {
    listen       5984;
    server_name  localhost;

    location / {
      proxy_pass https://cloudant_backend;
      proxy_redirect off;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_set_header Host <hostname>.cloudant.com;
      proxy_set_header Authorization "Basic <base64encodedusernamepassword>";
    }
  }
}

Original source nginx.conf: https://github.com/greenmangaming/cloudant-nginx

However, there is a more efficient option for backend authentication by performing an HTTP POST on the /_sessionendpoint to obtain an authentication cookie that is reused on subsequent requests.

Question : is this possible with nginx or Apache httpd? If so, how?

+4
1

:

cookie HUP, .

/ , , (, - ). , FastCGI, this, , CGI [ ]. , CGI , .

- , , cookie . , CGI ( nginx? ), cookie.

nginx soruces. , nginx, , , , .

, , .

+2

Source: https://habr.com/ru/post/1568741/


All Articles