Welcome! Log In Create A New Profile

Advanced

slow nginx behavior when using as reverse proxy for https

Bhuvan Gupta
September 12, 2020 03:06AM
*Community,*

Same as asked here also:
https://stackoverflow.com/questions/63857630/slow-nginx-behavior-when-using-as-reverse-proxy-for-https

*Setup:*

1. Dummy SSL endpoint https://hookb.in/VGQ3wdGGzKSE22bwzRdP
2. Install Nginx on localhost

*Steps:*

1.

Hit the hookb.in endpoint using browser for very first time and we get
network activity like below. It took 865 ms [image: enter image
description here] https://i.stack.imgur.com/fXugQ.png
Fig 1
2.

Subsequent hit to hookb.in endpoint using browser take much less time as
it is using the same tcp connection, below is the screen shot for ref. (All
Good!!)
[image: enter image description here]
https://i.stack.imgur.com/GheyZ.png
Fig 2
3.

setup the http-> https reverse proxy using below nginx config

worker_processes 1;
events {
worker_connections 1024;
}
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?*
I understand with reverse proxy we are adding extra hop , but 200ms is
big difference.
*How can i fix it ?*
[image: enter image description here]
https://i.stack.imgur.com/3mSeA.png

Any Help will be appricated!! Thank
_______________________________________________
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: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready