0

I'm trying configure nginx to cache my api post result, but not work yet. Below the steps I did: 1 - I installed nginx 2 - I create the configuration file: "worker_processes 1;

events {

worker_connections 1024;

}

http {

proxy_cache_path  /var/cache/nginx/oracle-query levels=1:2 keys_zone=oracle-query:10m max_size=1g

             inactive=310s use_temp_path=off;



server {



    listen 80;



    root   /home/docker-nginx/html;

    index  index.html index.htm;



    server_name 172.17.0.1;



    location /oracle-query {

        auth_basic off;



        add_header Cache-Control "no-cache, must-revalidate, max-age=0";

        add_header X-Proxy-Cache $upstream_cache_status;



        proxy_cache oracle-query;

        proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504 http_404;

        proxy_cache_lock on;

        proxy_cache_valid any 600s;

        proxy_ignore_headers X-Accel-Expires Expires Cache-Control;



        proxy_pass http://172.17.0.1:8081/r/vivo-person/person;

    }



    location / {

            proxy_pass      http://172.17.0.1:8081;

        }



}

}" 3 - I started nginx cache with this configuration: sudo docker run --link fnserver:fnserver --name nginx-cache -p 80:80 -p 443:443 -v $PWD/nginx.conf:/home/vmfn/docker-nginx/nginx.conf:ro nginx My completer flow is sudo fn apps config set vivo-person COMPLETER_BASE_URL "http://$DOCKER_LOCALHOST:8081"

Without nginx my flow works well, but when I attribute completer listener to port 80, I have issues too.

I need some help or tutorial to configure this in my fn.

1 Answers1

0

I think

proxy_pass http://172.17.0.1:8081/r/vivo-person/person;

should most likely be proxy_pass http://172.17.0.1:8080/r/vivo-person/person;

8080 is the fn server port (by default) and 8081 is flow

It looks like you are trying to cache the whole function call so you should proxy to 8080 (fnserver)

Zootalures
  • 161
  • 3