nginx proxy_cache для отдельных запросов

http {
 
proxy_cache_path  /var/cache/nginx/cacheone levels=1:2 keys_zone=cacheone:20m max_size=1024m;
 
...
}
 
server {
 
    ...
 
    set $mykey "";
 
    location ... {
         if ($query_string ~ "(foo.*)")
         {
             set $mykey $1;
             error_page 404  =  @cacheone;
             return 404;
         }
 
        ...
    }
 
    location @cacheone {
        proxy_cache cacheone;
        proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$mykey";
        proxy_cache_valid 200 301 302 304 7m;

User tags

dpkg mkfs mdadm KVM ddos initrd tiger zRam opcontrol ansible DRBD drupal java xfs nfs4 bridge OpenSSL arch apt cluster conntrack scsi bacula ps StorMan raid etch exim docker-compose proxy top pam mysql lts core dump shellshock ardour tzdata bug 3Ware cpu usage X forwarding lubuntu hotplug sysrq chromium video storage ip lenny sg tar virt-install vrrpd SpamAssassin squeeze bash ubuntu perl mariadb dstat oprofile Areca NFS rtl8723be qcow2 rpm encrypt opreport find ulimit openvpn keyboard LVM regex centos 7 boot build noop soa dns tin flash sysfs bonding taskset xen numa nginx cpu git vlan qemu iowait SuperMicro xhost dovecot corosync xargs ipmitool ipmi security erase CPAN bind equalizer backup routing MegaRAID lstat docker fail2ban tftp gpg arp shorewall rsync iostat vim .htaccess search dhcp glusterfs htop fio grub puppet su wget mount alsa cgroups SSD pacemaker usb gdb asoundrc gtk newgrp munin Swift PXE fido7 RT nvidia SYN AMD vrrp graylog2 dhclient /etc/network/interfaces in-addr.arpa ha tun vtysh quagga alien cache sysresccd exim4 MODx CentOS source limit_conn kernel jackd slab Adaptec sysctl.conf php leap second APU virtualbox sftp iops apache hdparm arping youtube OpenStack sysctl firefox iptables ssh cpanm LSI deb groups elliptics sublime wordpress chroot profiling rtsp tool HDFS glxinfo bscan language pulseaudio idmapd replication gre lxc debian cfq swap pvmove perlbrew raid5 Salt HTTPS backtrace iSCSI performance parallel radeon PTR freedos virsh debootstrap rkhunter route netfilter