I have a docker API server running locally on port 9000, and a node client fetching this API using POST.
When HTTP-Toolkit is set to intercept, it successfully creates another container and restart the API container with added proxy environment variables:
HTTP_PROXY=http://172.17.0.1:8000
HTTPS_PROXY=http://172.17.0.1:8000
http_proxy=http://172.17.0.1:8000
https_proxy=http://172.17.0.1:8000
WS_PROXY=http://172.17.0.1:8000
WSS_PROXY=http://172.17.0.1:8000
GLOBAL_AGENT_HTTP_PROXY=http://172.17.0.1:8000
CGI_HTTP_PROXY=http://172.17.0.1:8000
npm_config_proxy=http://172.17.0.1:8000
npm_config_https_proxy=http://172.17.0.1:8000
npm_config_scripts_prepend_node_path=false
SSL_CERT_FILE=/.http-toolkit-injections/ca.pem
NODE_EXTRA_CA_CERTS=/.http-toolkit-injections/ca.pem
DENO_CERT=/.http-toolkit-injections/ca.pem
PERL_LWP_SSL_CA_FILE=/.http-toolkit-injections/ca.pem
GIT_SSL_CAINFO=/.http-toolkit-injections/ca.pem
CARGO_HTTP_CAINFO=/.http-toolkit-injections/ca.pem
CURL_CA_BUNDLE=/.http-toolkit-injections/ca.pem
AWS_CA_BUNDLE=/.http-toolkit-injections/ca.pem
HTTP_TOOLKIT_ACTIVE=true
HTTP_TOOLKIT_OVERRIDE_PATH=/.http-toolkit-injections/overrides
PATH=/.http-toolkit-injections/overrides/path:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUBYLIB=/.http-toolkit-injections/overrides/gems
PYTHONPATH=/.http-toolkit-injections/overrides/pythonpath
NODE_OPTIONS=--require /.http-toolkit-injections/overrides/js/prepend-node.js
JAVA_TOOL_OPTIONS=-javaagent:"/.http-toolkit-injections/overrides/java-agent.jar"=172.17.0.1|8000|/.http-toolkit-injections/ca.pem
PHP_INI_SCAN_DIR=/.http-toolkit-injections/overrides/php
DOCKER_BUILDKIT=0
But,
- If I don’t change the client fetch call, HTTP-Toolkit intercepts nothing (no line in view), but API server is replying to the Node server to serve the client.
- If I change the fetch call to http://locahost:8000/my-api, the browser console throws a CORS issue coming from http://locahost:8000/my-api and intercept shows 2 “500” lines. And GET, which is not supposed to be implemented, throws: Error: Passthrough loop detected. This probably means you’re sending a request directly to a passthrough endpoint, which is forwarding it to the target URL, which is a passthrough endpoint, which is forwarding it to the target URL, which is a passthrough endpoint.
AFAIU, I shouldn’t need to change to 8000, but I don’t get what I’m missing to intercept.
Is there a more manual way to set it up as a passthrough?
Finally, when I shut down HTTP-Toolkit, it DELETES the API container! Is there a way to prevent this behavior?