nginx not caching response from reverse proxy
NickName:Justin Thomas Ask DateTime:2016-08-24T06:32:01

nginx not caching response from reverse proxy

http://nginx.org/en/docs/http/ngx_http_memcached_module.html

Basic config is here:

worker_processes  2;

events {
    worker_connections  1024;
}

error_log  /var/log/nginx/nginx_error.log  warn;
error_log  /var/log/nginx/nginx_error.log  info;

http {
    upstream backend {
        server localhost:3000;
    }

  server {
      listen 80;

      location / {
          set            $memcached_key $uri;
          memcached_pass 127.0.0.1:11211;
          error_page     404 = @fallback;
      }

      location @fallback {
          proxy_pass     http://backend;

      }
  }
}

It reverse proxy's the request when hitting port 80, but the logs always say:

2016/08/23 15:25:19 [info] 68964#0: *4 key: "/users/12" was not found by memcached while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /users/12 HTTP/1.1", upstream: "memcached://127.0.0.1:11211", host: "localhost"

Copyright Notice:Content Author:「Justin Thomas」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39111707/nginx-not-caching-response-from-reverse-proxy

More about “nginx not caching response from reverse proxy” related questions

How to set up Nginx as a caching reverse proxy?

I heard recently that Nginx has added caching to its reverse proxy feature. I looked around but couldn't find much info about it. I want to set up Nginx as a caching reverse proxy in front of Apache/

Show Detail

nginx not caching response from reverse proxy

http://nginx.org/en/docs/http/ngx_http_memcached_module.html Basic config is here: worker_processes 2; events { worker_connections 1024; } error_log /var/log/nginx/nginx_error.log warn;

Show Detail

Nginx Caching 301 Response

I have a nginx reverse proxy that forwards all requests to a server that then redirects (301) to an aws service. The requests returns pdb files that can be pretty big and normally the same request ...

Show Detail

How do I disable caching in an Nginx reverse proxy?

Will it have caching behavior by default in the reverse proxy configuration below? location / { proxy_pass http://12.23.45.78:8080; proxy_http_version 1.1; proxy_set_header Connection &...

Show Detail

Nginx caching 500 Internal Server Error response

We are using Nginx as reverse proxy. From last 8-9months we are facing one issue in which nginx 500 response spike obseved. And we didnt see any call to upstream. It seems like Nginx caches the 500

Show Detail

nginx - streaming response to client, but also caching

I have what appear to be competing desires with nginx, but both of them seem like something you'd want. I am using nginx as a reverse proxy to a python HTTP API server. Let's assume there is a sin...

Show Detail

How to prevent nginx reverse proxy recompress the upstream compressed response?

I have nginx reverse proxy that receives brotli compressed response from upstream (Varnish cache). But, the reverse proxy serves brotli compressed response to browser only if I setup "brotli on;&

Show Detail

NGINX Reverse proxy response

I am using an NGINX server as a reverse proxy. The NGINX server accepts a request from an external client (HTTP or HTTPS doesn't matter) and passes this request to a backend server. The backend ser...

Show Detail

nginx be both reverse proxy and web server

I currently use nginx with passenger to serve my rails app. considering including a caching reverse proxy to the equation. Can I use the same instance of nginx as a reverse proxy (running on port 80,

Show Detail

Nginx reverse proxy: Connection Refused vs Empty Response

I want to check if port is open using javascript and reverse nginx proxy. I have scenario, when page behind nginx proxy can either return Empty Response, or return Connection Refused (if the servi...

Show Detail