gewei2000 edited a comment on issue #3390:
URL: https://github.com/apache/apisix/issues/3390#issuecomment-765149345


   > > Configure `location ~* /service_a/(.*)\.(png|jpg|js|css)$` in apisix, 
can it solve your problem?
   > 
   > this is not a best way in APISIX. we can use the Route + proxy cache 
plugin to implement this feature.
   > 
   > Route: match the request `/service_a/(.*)\.(png|jpg|js|css)$`
   > Proxy-cache plugin: implement the proxy and cache file.
   
   can not match any route
   
   route config
   ```
   {
        "id": "1",
        "name": "static_cache",
        "plugins": {
                "proxy-cache": {
                        "cache_zone": "disk_cache_one",
                        "cache_key": ["$host", "$uri", "$is_args", "$args"],
                        "cache_bypass": ["$arg_bypass"],
                        "cache_method": ["GET"],
                        "cache_http_status": [200],
                        "hide_cache_headers": true,
                        "no_cache": ["$arg_test"]
                }
        },
        "upstream_id": "1",
        "uris": ["/service_a/(.*)\\.(png|jpg|js|css)$"]
   }
   ```
   
   request url:
   ```
    /service_a/111.png
   ```
   
   debug log:
   ```
   2021/01/22 13:52:53 [info] 39#39: *4987 [lua] init.lua:387: 
http_access_phase(): not find any matched route, client: 10.0.0.3, server: , 
request: "GET /service_a/111.png HTTP/1.1", host: "10.1.2.2:9081"
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to