# Web & H5 Using Secure Gateways
This article describes how to use the WEB Access the WeChat security gateway in the app.
Please note: WEB Application access only supports the basic version of the package and above.
# I. Access Steps
# 1. WeChat scan code login Donut Security Gateway Console, agree to the Security Gateway Service Agreement and agree to complete the opening immediately. inSecurity Gateway - Service ConfigurationPage, click Add Business and start configuring.
# 2. Add a business page, select the business type asWeb, followed by the business name (fill in your own) and the origin domain name (the domain name you expect to protect).
# 3. In your own web Application, the introduction of a security gateway Web SDK
<script src="https://web-9gikcbug35bad3a8-1304825656.tcloudbaseapp.com /sdk/2.1.0/cloud.js"></script>
<!-- Below is the eruda Debugging tools, only for development, need to be removed before the on-line -->
<script src="//cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init()</script>
Be careful 2.0.3 Version above SDK No longer allowed to open DevTools Debugging tool, otherwise the request will be intercepted. Can be used eruda Wait for debugging tools to view console journal
# 4. Initialize gateway objects and instances
const c1 = new cloud.Cloud({
identityless: true,
resourceAppid: 'wx069a87eae381af2b', // Appid, fill in the access Mini Program appid
config: {
customDomain: 'https://a224faf18-wx66e29c62636ff9e5.preview.wxcloudrun.com' // Gateway access node domain name needs to be filled in
}
})
c1.init() // Initialization instance
const gateway = c1.services.Gateway({ domain: 'a224faf18-wx66e29c62636ff9e5.preview.wxcloudrun.com' }) // Gateway access node domain name, does not contain protocol header
# 5. Request gateway address
gateway.call({
path: 'https://httpbin.org/post',
header:{
'X-WX-HTTP-MODE': 'REROUTE', // Required
'Content-Type':'application/json'
},
method: 'post',
data: { foo: 'bar' }
}).then(res => {
console.log(res) // Gateway Return Results
})
# II. Capacity Development
Security Gateway Support H5 In combination with different request libraries, refer to the following documentation