Я хочу проверить, существует ли файл локально, а если нет, я хочу передать запрос приложению через прокси-сервер, который создает этот файл.
Вот что я уже пробовал:
# do the rights processing for non-docroot-paths
<Directory /webapps/mapproxy/cache_data/demo>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
<LocationMatch "^/tiles/(.*)$">
# check if exists
RewriteCond /webapps/mapproxy/cache_data/demo/$1 !-f
# deliver locally if file exists
RewriteRule (.*) - [L]
# if file doesn't exist, send request to backend
RewriteRule "^/(.*)" "http://localhost:8000/wmts/demo/webmercator/$1" [P]
ProxyPassReverse http://localhost:8000/wmts/demo/webmercator/$1
</LocationMatch>
Некоторые примеры:
1. request to http://$URL/tiles/12/4255/5469.png
2. internal "/webapps/mapproxy/mapproxy/cache_data/demo/12/4255/5469.png" exists
3. file should get delivered from internal storage
1. request to http://$URL/tiles/12/4255/5469.png
2. internal "/webapps/mapproxy/mapproxy/cache_data/demo/12/4255/5469.png" does NOT exist
3. proxy-request to "http://localhost:8000/wmts/demo/webmercator/12/4255/5469.png"
3.1 it permanently generates "/webapps/mapproxy/mapproxy/cache_data/demo/12/4255/5469.png"
3.2 it delivers "/webapps/mapproxy/mapproxy/cache_data/demo/12/4255/5469.png"
Может быть, мне также нужно использовать Псевдоним ?