Loading...
Loading...
Compare original and translation side by side
ngrokngrok config add-authtoken <TOKEN>ngrokngrok config add-authtoken <TOKEN>ngrok config checkngrok config add-authtoken <TOKEN>Before I expose your service, I need a few details:
1. **Port**: I see your app runs on port 3000. Is that correct?
2. **Domain**: Use your dev domain, or do you have a custom domain?
3. **Access control**: Open access, or require login (Google/GitHub/etc.)?
4. **Save config?**: One-time setup, or save for reuse?package.json--port.envPORT=docker-compose.ymlsomething.ngrok-free.devngrok http PORTERR_NGROK_15013ngrok config checkngrok config add-authtoken <TOKEN>在为您暴露服务前,我需要了解几个细节:
1. **端口**:我检测到您的应用运行在3000端口,是否正确?
2. **域名**:使用您的开发域名,还是您有自定义域名?
3. **访问控制**:开放访问,还是需要登录验证(Google/GitHub等)?
4. **保存配置?**:仅单次使用,还是保存配置以便复用?package.json--port.envPORT=docker-compose.ymlsomething.ngrok-free.devngrok http PORTERR_NGROK_15013ngrok http {PORT} &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1--url https://{DOMAIN}ngrok http {PORT} &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1--url https://{DOMAIN}on_http_request:
- actions:
- type: oauth
config:
provider: googlegoogleallowon_http_request:
- actions:
- type: oauth
config:
provider: google
- expressions:
- "actions.ngrok.oauth.identity.email != 'user@example.com'"
actions:
- type: deny
config:
status_code: 403on_http_request:
- actions:
- type: oauth
config:
provider: google
- expressions:
- "!actions.ngrok.oauth.identity.email.endsWith('@your-company.com')"
actions:
- type: deny
config:
status_code: 403!(... in ['a@x.com', 'b@x.com'])on_http_request:
- actions:
- type: rate-limit
config:
name: default-rate-limit
algorithm: sliding_window
capacity: 200
rate: "60s"
bucket_key:
- conn.client_ip
- type: owasp-crs-request
config:
on_error: halt
on_http_response:
- actions:
- type: owasp-crs-response
config:
on_error: haltngrok http {PORT} --traffic-policy-file .ngrok/traffic-policy.yml &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1--url https://{DOMAIN}on_http_request:
- actions:
- type: oauth
config:
provider: googlegoogleallowon_http_request:
- actions:
- type: oauth
config:
provider: google
- expressions:
- "actions.ngrok.oauth.identity.email != 'user@example.com'"
actions:
- type: deny
config:
status_code: 403on_http_request:
- actions:
- type: oauth
config:
provider: google
- expressions:
- "!actions.ngrok.oauth.identity.email.endsWith('@your-company.com')"
actions:
- type: deny
config:
status_code: 403!(... in ['a@x.com', 'b@x.com'])on_http_request:
- actions:
- type: rate-limit
config:
name: default-rate-limit
algorithm: sliding_window
capacity: 200
rate: "60s"
bucket_key:
- conn.client_ip
- type: owasp-crs-request
config:
on_error: halt
on_http_response:
- actions:
- type: owasp-crs-response
config:
on_error: haltngrok http {PORT} --traffic-policy-file .ngrok/traffic-policy.yml &
sleep 3
curl -s http://localhost:4040/api/tunnels | grep -o '"public_url":"[^"]*"' | head -1--url https://{DOMAIN}.ngrok/traffic-policy.yml.ngrok/expose.sh#!/bin/bash
set -e
echo "Your service will be at: https://{DOMAIN}"
ngrok http {PORT} --url https://{DOMAIN} --traffic-policy-file .ngrok/traffic-policy.yml--traffic-policy-file--urlpackage.json{ "scripts": { "tunnel": "bash .ngrok/expose.sh" } }.ngrok/traffic-policy.yml.ngrok/expose.sh#!/bin/bash
set -e
echo "Your service will be at: https://{DOMAIN}"
ngrok http {PORT} --url https://{DOMAIN} --traffic-policy-file .ngrok/traffic-policy.yml--traffic-policy-file--urlpackage.json{ "scripts": { "tunnel": "bash .ngrok/expose.sh" } }pkill ngrokpkill ngrokngrok config add-api-key <KEY>ngrok api reserved-domains create --domain "{DOMAIN}"forward-internalngrok api endpoints create --url "https://{DOMAIN}" --bindings public --traffic-policy "$(cat .ngrok/traffic-policy.yml)"- type: forward-internal
config:
url: https://{NAME}.internalngrok http {PORT} --url https://{NAME}.internalngrok api endpoints delete {ENDPOINT_ID}ngrok config add-api-key <KEY>ngrok api reserved-domains create --domain "{DOMAIN}"forward-internalngrok api endpoints create --url "https://{DOMAIN}" --bindings public --traffic-policy "$(cat .ngrok/traffic-policy.yml)"- type: forward-internal
config:
url: https://{NAME}.internalngrok http {PORT} --url https://{NAME}.internalngrok api endpoints delete {ENDPOINT_ID}