Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

nginx rest api caching

proxy_cache_path /var/cache/nginx 
        keys_zone=cache_test:10m 
        levels=1:2 
        inactive=2M 
        max_size=10g
        use_temp_path=off;

proxy_cache_key $scheme$proxy_host$request_uri;
proxy_cache_methods GET;

log_format cache '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" cs=$upstream_cache_status';

server {

        listen 3001;

        access_log /var/log/nginx/cache_test-proxy.access.log cache;
        error_log  /var/log/nginx/cache_test-cache.error.log;

        set $backend http://127.0.0.1:3000;

        location / {
                proxy_pass $backend;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }

        location /products {
                proxy_pass $backend;
                proxy_cache_bypass $http_pragma;
                proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
                proxy_cache_background_update on;
                proxy_cache_lock on;

                add_header X-Cache-Status $upstream_cache_status;

                proxy_cache cache_test;
                proxy_cache_valid 200 304 30s;
        }
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: two absolute elements are overlapping css help 
Typescript :: convert c# class to typescript 
Typescript :: Error in plugin @nomiclabs/hardhat-etherscan: The constructor for contracts/DAVID.sol:GuiltyDavid has 4 parameters but 0 arguments were provided instead. 
Typescript :: typescript one of array 
Typescript :: go Array’s length is part of its type. 
Typescript :: Error: "prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0 
Typescript :: python ffmpeg convert ts to mp4 
Typescript :: display entry count for specific column using value_counts spyder. 
Typescript :: how to compile automatically in typescript 
Typescript :: google app scripts loop 
Typescript :: typescript string 
Typescript :: typescript array contains string 
Typescript :: invoke lambda after cdk deploy 
Typescript :: htmlspecialchars() expects parameter 1 to be string array given in laravel blade 
Typescript :: Push Type Typescript 
Typescript :: c# merge two lists different types 
Typescript :: laravel middleware for apis 
Typescript :: Scroll, Position 
Typescript :: angular api rest 
Typescript :: testing in different environments 
Typescript :: undetermined number of arguments in function r 
Typescript :: how test with limited information 
Typescript :: mat dialog position absolute 
Typescript :: This program prompts the user for two numbers, calls a function to determine the smaller number and prints the smaller number that is returned from the function 
Typescript :: who indirectly elects the president 
Typescript :: adonis route group 
Typescript :: How to pass multiple route parameters in Ionic-Angular? 
Typescript :: TypeError: __cinit__() takes at least 2 positional arguments (0 given) 
Typescript :: 1st heghts value in sql 
Typescript :: typescript timeout browser 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =