Skip to main content

HTTP Access Related

Troubleshooting HTTP Access Errors

Determine whether the HTTP status code is returned by the CloudRun gateway or by the upstream service. You can check if the response headers contain the X-Cloudbase-Upstream-Status-Code header. If this header is present and its value matches the HTTP status code, it indicates that the status code is returned by the upstream service. Additionally, if a specific error code is returned, you can refer to the CloudBase http access error code documentation to troubleshoot the specific cause. Specific error codes can be found in HTTP Access Service Error Codes.

Troubleshooting websocket Connection Interruptions

The gateway layer recycles idle connections. Therefore, after a websocket connection is established, if there is no data transmission for a long time, the gateway will actively close inactive connections. It is recommended that the client or server sends a heartbeat packet every 10s. Additionally, the client should implement automatic reconnection to prevent interruptions caused by network fluctuations or gateway layer service restarts. If a heartbeat mechanism is already in place but websocket connections still frequently disconnect, you can contact our engineers for troubleshooting.

Does CloudBase Support SSE

Yes

  • You can directly access the SSE address via a browser
  • You can also use Node.js code
// 1. First, install the dependency: npm install eventsource
// 2. Name the following code as main.js, then execute: node main.js
const {EventSource} = require('eventsource');
const eventSource = new EventSource('Your service domain or custom domain'); // Ensure the path is correct

eventSource.onopen = () => {
};
eventSource.onmessage = (event) => {
console.log('Received message:', event.data);
};
eventSource.onerror = (error) => {
};
  • You can also implement SSE interactions using more programming languages.