Welcome! Log In Create A New Profile

Advanced

Re: slow nginx behavior when using as reverse proxy for https

Maxim Dounin
September 13, 2020 06:46PM
Hello!

On Sat, Sep 12, 2020 at 12:34:15PM +0530, Bhuvan Gupta wrote:

[...]

> http {
> keepalive_timeout 65;
> server {
> listen 80;
> server_name localhost;
> location /session {
> proxy_pass https://hookb.in/VGQ3wdGGzKSE22bwzRdP;
> proxy_http_version 1.1;
> proxy_set_header Connection "keep-alive";
> proxy_ssl_session_reuse on;
> proxy_socket_keepalive on;
> }
> }
> }
>
>
>
> 1. Now from browser hit http://127.0.0.1/session and nginx will work
> fine and proxy the content from https site.
> But nginx response time is always 200ms more than compared to accessing
> https site directly. Screen shot below for ref
> *Why nignx is taking extra time , is it opening new ssl connection every
> time or is there something else?*

The configuration you are using implies that nginx will open a new
connection to upstream server for each proxied request. To
configure nginx to keep upstream connections alive, please see the
description of the "keepalive" directive here:

http://nginx.org/r/keepalive

Notably, make sure to configure an upstream block with the
"keepalive" directive. Something like this at the http level
should work, assuming no other changes in the configuration:

upstream hookb.in {
server hookb.in:443;
keepalive 2;
}

In the example above, nginx will keep up to two connections.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

slow nginx behavior when using as reverse proxy for https

Bhuvan Gupta September 12, 2020 03:06AM

Re: slow nginx behavior when using as reverse proxy for https

Maxim Dounin September 13, 2020 06:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 324
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready