520 Web Server Returned an Unknown Error
Cloudflare specific error. The origin server returned an empty, unknown, or unexpected response.
When and Why to Use It
Section titled “When and Why to Use It”Cloudflare specific error. The origin server returned an empty, unknown, or unexpected response.
Usage Examples
Section titled “Usage Examples”import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => { throw new HttpException('Web Server Returned an Unknown Error', 520);});import { Controller, Get, HttpException } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') getResource() { throw new HttpException('Web Server Returned an Unknown Error', 520); }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(520).json({ error: 'Web Server Returned an Unknown Error' });});import { Controller, Get, HttpException } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') getResource() { throw new HttpException('Web Server Returned an Unknown Error', 520); }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 520; ctx.body = { error: 'Web Server Returned an Unknown Error' }; }});