mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
44 lines
810 B
Markdown
44 lines
810 B
Markdown
# Proxy Example: HTTPS Logging
|
|||
|
|
|
||
|
|
This example demonstrates using the PMG proxy server to intercept and log HTTPS requests to package registries.
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
### Build and Run
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd examples/proxy
|
||
|
|
go run .
|
||
|
|
```
|
||
|
|
|
||
|
|
### Configure Your Environment
|
||
|
|
|
||
|
|
Open a new terminal and configure the proxy:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
export HTTPS_PROXY=http://127.0.0.1:8888
|
||
|
|
export NODE_EXTRA_CA_CERTS=./ca-cert.pem
|
||
|
|
export SSL_CERT_FILE=./ca-cert.pem
|
||
|
|
export PIP_CERT=./ca-cert.pem
|
||
|
|
export REQUESTS_CA_BUNDLE=./ca-cert.pem
|
||
|
|
export PIP_PROXY=http://127.0.0.1:8888
|
||
|
|
```
|
||
|
|
|
||
|
|
### Test with Package Managers
|
||
|
|
|
||
|
|
Test with `npm`:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm --no-cache --prefer-online install express
|
||
|
|
```
|
||
|
|
|
||
|
|
Test with `pip`:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pip3 --proxy http://127.0.0.1:8888 index versions requests
|
||
|
|
```
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pip3 install --proxy http://127.0.0.1:8888 --no-cache-dir requests
|
||
|
|
```
|