completely reworked caching, now cache by exception (/blobs/ only essentially)

- now only /v2/.../blobs/... URIs are actually cached (together with their redirect catchers)
- /manifests/, /token, and /v2/ are not cached anymore, which should solve a lot of problems
- better messages for /v1 attempts
- fix usage of $connect_host:443 (which is hostname:port and causes errors to be logged) to $connect_addr (which returns an IP:port) in the proxy layer
This commit is contained in:
Ricardo Pardini
2018-11-04 16:43:53 +01:00
parent 8ff06e3dec
commit 7724f3ba15
3 changed files with 47 additions and 57 deletions

View File

@@ -58,12 +58,8 @@ NGINX_BIN="nginx"
if [[ "a${DEBUG}" == "atrue" ]]; then
# in debug mode, change caching layer to listen on 444, so that mitmproxy can sit in the middle.
echo " listen 444 ssl default_server;" > /etc/nginx/caching.layer.listen
echo "error_log /var/log/nginx/error.log debug;" > /etc/nginx/error.log.debug.warn
# use debug binary
NGINX_BIN="nginx-debug"
echo "Starting in DEBUG MODE."
echo "Starting in DEBUG MODE (mitmproxy)."
echo "Run mitmproxy with reverse pointing to the same certs..."
mitmweb --no-web-open-browser --web-iface 0.0.0.0 --web-port 8081 \
--set keep_host_header=true --set ssl_insecure=true \
@@ -73,6 +69,12 @@ if [[ "a${DEBUG}" == "atrue" ]]; then
echo "Access mitmweb via http://127.0.0.1:8081/ "
fi
if [[ "a${DEBUG_NGINX}" == "atrue" ]]; then
echo "Starting in DEBUG MODE (nginx)."
echo "error_log /var/log/nginx/error.log debug;" > /etc/nginx/error.log.debug.warn
# use debug binary
NGINX_BIN="nginx-debug"
fi
echo "Testing nginx config..."
${NGINX_BIN} -t