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