HTTPS to HTTPS proxy in Apache Server

Add the following configurations to the virtual host to enable https to https proxy in Apache Web Server.

SSLProxyEngine on
SSLProxyVerify none 
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

You may get the following error if these configurations are not added to the virtual host “Error during SSL Handshake with remote server”


How to set url length in Nginx Request (error code: 414, uri too large)

Today I got one annoying error after deploying the new version of the web application in nginx web server. Initially I thought the web app was buggy, but when I inspected the requests and response, I found the following error.

error code: 414, uri too large

On checking more details around this, I found that this issue can be fixed by adjusting few configurations in nginx. The parameter to modify is large_client_header_buffers.

This parameter sets the maximum number and size of buffers used for reading large client request header. A request line cannot exceed the size of one buffer, or the 414 (Request-URI Too Large) error is returned to the client. A request header field cannot exceed the size of one buffer as well, or the 400 (Bad Request) error is returned to the client. Buffers are allocated only on demand. By default, the buffer size is equal to 8K bytes. If after the end of request processing a connection is transitioned into the keep-alive state, these buffers are released.

Syntax : large_client_header_buffers number size ;

The default value is 4 and the size is 8 KB. You can increase this value to a higher value to fix this issue.

large_client_header_buffers 16 128k;

If you are facing issues even after making these changes, then add the following configuration to the server block in nginx.

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

client_max_body_size 24M;
client_body_buffer_size 128k;

client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;


Hope this helps 🙂  Please comment if you are facing any issues.


How to enable Compression in Nginx

If you are using Nginx webserver, you have to try this out. I started exploring for this option when I faced slowness in rending the pages in one of the applications. When I checked the backend services, the web service API was given the responses quickly, but the page was taking more time to load. On further inspection, I figured out that the API was sending a a data of size 5 MB. So the browser will first download this data and this speed depends on the bandwidth.

I explored further and figured out the way of compressing API body using the webserver. This will speed up the API calls as the data transferred over the network will be very less. In my case, the 5 MB data became few KBs (size of compressed data). This will get extracted quickly in the browser and it gets rendered in the screen.

The required configurations are pasted below for quick reference.

Make the changes in the config file /etc/nginx/nginx.conf. Add the following content to the nginx.conf file.

gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";


The explanation of each of the parameters are given below.

  • gzip on; – enables gzip compression in nginx
  • gzip_vary on: – tells proxies to cache both compressed and normal versions of a resource
  • gzip_types – The type of files that can be compressed
  • gzip_disable “MSIE [1-6]\.”;  – Disable compression for Internet Explorer versions 1-6
  • gzip_min_length 1024; – Nginx will compress the files greater than this size and it will not compress anything less than this size.
  • gzip_proxied – compress data even for clients that are connecting via proxies


This is one of the way to improve the performance of APIs. The developers can focus on enhancing their logic and the admin or DevOps engineer can focus on enhancing the web server with optimal configuration. There are so many tricks and magics we can do in the web server. I will try to post some of those in my blog.

Hope this helps. 🙂 . Please comment if you face any issues.