File contents CSRF Protection
[!NOTE]
For the RPC types to work properly in a monorepo, in both the Client's and Server's tsconfig.json files, set "strict": true in compilerOptions. Read more.
[!NOTE]
For the RPC types to work properly in a monorepo, in both the Client's and Server's tsconfig.json files, set "strict": true in compilerOptions. Read more.
Available Resources
Quick Start
Features
Use-cases
Who is using Hono?
Hono in 1 minute
Ultrafast
Lightweight
Multiple routers
Web Standards
Middleware & Helpers
Basic Authentication
URL: /docs/middleware/builtin/basic-auth
Bearer Authentication
URL: /docs/middleware/builtin/bearer-auth
Body Limit
URL: /docs/middleware/builtin/body-limit
Cache
URL: /docs/middleware/builtin/cache
Compress
URL: /docs/middleware/builtin/compress
Context Storage
URL: /docs/middleware/builtin/context-storage
Cookie
URL: /docs/helpers/cookie
CORS
URL: /docs/middleware/builtin/cors
ETag
URL: /docs/middleware/builtin/etag
html
JSX
JWT Authentication
URL: /docs/middleware/builtin/jwt
Logger
URL: /docs/middleware/builtin/logger
Language
URL: /docs/middleware/builtin/language
Pretty JSON
URL: /docs/middleware/builtin/pretty-json
Secure Headers
URL: /docs/middleware/builtin/secure-headers
SSG
Streaming
URL: /docs/helpers/streaming
GraphQL Server
Firebase Authentication
Sentry
Developer Experience
Throwing HTTPExceptions
Handling HTTPExceptions
param()
query()
queries()
header()
parseBody()
json()
text()
arrayBuffer()
blob()
formData()
valid()
routePath
matchedRoutes
path
url
method
raw
cloneRawRequest()
req
status()
header()
body()
text()
json()
html()
notFound()
redirect()
res
set() / get()
var
render() / setRenderer()
executionCtx
event
env
error
ContextVariableMap
Basic
Path Parameter
Regexp
Including slashes
Chained route
Grouping
Grouping without changing base
Base path
Routing with hostname
Routing with host Header value
Routing priority
Grouping ordering
Methods
Not Found
Error Handling
fire()
fetch()
request()
mount()
strict mode
router option
Generics
hono
hono/quick
hono/tiny
Which preset should I use?
Is there an official Renovate config for Hono?
Contributing
Sponsoring
Other Resources
Settings
Usage
Metadata hoisting
Fragment
PropsWithChildren
Inserting Raw HTML
Memoization
Context
Async Component
Suspense
ErrorBoundary
StreamingContext
Integration with html Middleware
With JSX Renderer Middleware
Override type definitions
Available Helpers
Accepts
URL: /docs/helpers/accepts
Adapter
URL: /docs/helpers/adapter
Cookie
URL: /docs/helpers/cookie
css
Dev
Factory
URL: /docs/helpers/factory
html
JWT
SSG
Streaming
URL: /docs/helpers/streaming
Testing
URL: /docs/helpers/testing
WebSocket
URL: /docs/helpers/websocket
Definition of Middleware
Execution order
Built-in Middleware
Custom Middleware
Context access inside Middleware arguments
Third-party Middleware
Request and Response
Env
Manual validator
Multiple validators
With Zod
Zod Validator Middleware
Standard Schema Validator Middleware
Counter example
render()
Hooks compatible with React
startViewTransition() family
the finish promise becomes fulfilled
The hono/jsx/dom runtime
Server
Client
Status code
Global Response
Not Found
Path parameters
Headers
init option
$url()
$path()
File Uploads
Custom fetch method
Custom query serializer
Infer
Parsing a Response with type-safety helper
Using SWR
Using RPC with larger applications
Known issues
Don't make "Controllers" when possible
factory.createHandlers() in hono/factory
Building a larger application
HEAD Request Best Practices
Passing arguments:
Commonly used arguments
Example flows
Troubleshooting & tips
Links & references
Usage
toSSG
Generate File
Middleware
Plugins
Import
sign()
verify()
decode()
Payload Validation
Custom Error Types
Supported AlgorithmTypes
getRouterName()
showRoutes()
Options
Import
Usage
Options
__Secure- and __Host- prefix
Following the best practices
Import
upgradeWebSocket()
RPC-mode
Examples
Import
testClient()
Import
createFactory()
createMiddleware()
factory.createHandlers()
factory.createApp()
Import
stream()
streamText()
streamSSE()
Error Handling
Import
env()
getRuntimeKey()
Import
Usage
Type Definitions
Import
Usage
matchedRoutes()
routePath()
baseRoutePath()
basePath()
Import
accepts()
Options
Import
html
raw()
Tips
Import
proxy()
Import
css
keyframes
cx
Usage in combination with Secure Headers middleware
createCssContext
Security
Tips
Routers
Cloudflare Workers
Deno
Bun
SaltyAom/bun-http-framework-benchmark
RegExpRouter
TrieRouter
SmartRouter
LinearRouter
PatternRouter
Motivation
RPC
Zod
Zod Validator Middleware
Writing API
Validation with Zod
Sharing the Types
Client
With React
1. Setup
2. Hello World
3. Run
Link : Make a GET request using cURL or Postman to `
4. Deploy
1. Install CLI
Install the Azure Functions Core Tools | Microsoft Learn
2. Setup
3. Hello World
4. Run
5. Deploy
1. Setup
2. Hello World
3. Deploy
Serve Binary data
Access AWS Lambda Object
Access RequestContext
Lambda response streaming
1. Install Bun
2. Setup
3. Hello World
4. Run
Change port number
Serve static files
Testing
1. Setup
2. Hello World
3. Run
4. Deploy
Bindings
Client-side
Cloudflare Pages Middleware
1. Setup
2. Hello World
3. Run
Change port number
WebSocket
Access the raw Node.js APIs
Serve static files
http2
Building & Deployment
1. Setup
2. Hello World
3. Setup serverless-devs
4. Deploy
1. Setup
2. Hello World
3. Run
4. Deploy
Pages Router
1. Setup
2. Hello World
3. Run
4. Deploy
Using Hono with other event handlers
Serve static files
Types
Testing
Bindings
Using Variables in Middleware
Deploy from GitHub Actions
Load env when local development
1. Setup
2. Hello World
3. Run
4. Deploy
Further reading
1. Setup
2. Hello World
3. Run
4. Deploy
Bindings
1. Setup
2. Hello World
3. Deploy
Callback
1. Setup
2. Hello World
3. Run
4. Deploy
Context
1. Install Deno
2. Setup
3. Hello World
4. Run
Change port number
Serve static files
Deno Deploy
Testing
npm and JSR
1. Setup
2. Set up WIT interface & dependencies
3. Hello Wasm
4. Build
5. Run
More information
Starter
Hello World
Return JSON
Request and Response
Return HTML
Return raw Response
Using Middleware
Adapter
Next step
1. Setup
2. Hello World
3. Run
1. Install the CLI
2. Project setup
3. Hello World
4. Deploy
Changing runtimes
Node.js
URL: /docs/getting-started/nodejs#building-deployment
Bun
Deno
Auth.js(Next Auth)
Casbin
Clerk Auth
Cloudflare Access
OAuth Providers
OIDC Auth
Firebase Auth
Verify RSA JWT (JWKS)
Stytch Auth
Ajv Validator
ArkType Validator
Class Validator
Conform Validator
Effect Schema Validator
Standard Schema Validator
TypeBox Validator
Typia Validator
unknownutil Validator
Valibot Validator
Zod Validator
Zod OpenAPI
Scalar
Swagger UI
Swagger Editor
Hono OpenAPI
hono-zod-openapi
ESLint Config
SSG Plugin Essential
Apitally (API monitoring & analytics)
Highlight.io
LogTape (Logging)
OpenTelemetry
Prometheus Metrics
Sentry
Pino logger
GraphQL Server
oRPC
tRPC Server
Bun Transpiler
esbuild Transpiler
Qwik City
React Compatibility
React Renderer
GlideMQ (Message Queue REST API + SSE)
Intlayer i18n
Bun Compress
Cap Checkpoint
Event Emitter
Geo
Hono Rate Limiter
Hono Problem Details (RFC 9457)
Hono Simple DI
InferDI
Idempotency (Stripe-style idempotency keys)
idempot-js
jsonv-ts (Validator, OpenAPI, MCP)
MCP
RONIN (Database)
Session
tsyringe
User Agent based Blocker
Import
Usage
Options
Platform specific Request IDs
AWS documentation: Context object
**Cloudflare Ray ID
**
Request ID on the Deno Blog
Fastly documentation: req.xid
Import
Usage
tryGetContext
Import
Usage
Options
Usage with Bun for large requests
Import
Usage
Supported Options
Middleware Conflict
Setting Content-Security-Policy
Setting Permission-Policy
Import
Usage
Options
Environment-dependent CORS configuration
Using with Vite
Import
Usage
Logging Details
PrintFunc
Options
Import
Usage
Options
Import
Usage
Options
Import
Usage
Options
Import
Usage
For example
Options
Import
Usage
The retained headers
Options
Import
Usage
Import
Usage
Options
More Options
Recipes
Import
Usage
Options
Nested Layouts
useRequestContext()
Extending ContextRenderer
Import
Usage
Options
Note
Import
Usage
Notes
Middleware Conflicts
Import
Usage
Options
Import
Basic Usage
Default Configuration
Key Behaviors
Advanced Configuration
Options Reference
Validation & Error Handling
Common Recipes
Import
Usage
Options
What this middleware validates
Import
Usage
Using verifyWithJwks outside of middleware
Configuring JWKS fetch request options
Options
Import
Usage
Rules
Error handling
Import
Usage
Result
Options
Import
Usage
Options
Link : string : Single allowed origin (e.g., `'
Additional Resources (Optional)
Optional Parameter
How to Use This Skill
Reference these resources when working with CSRF Protection.
1 --- 2 name: csrf-protection 3 description: Csrf Protection 4 --- 5 6 # CSRF Protection 7 8 > [!NOTE] 9 For the RPC types to work properly in a monorepo, in both the Client's and Server's tsconfig.json files, set `"strict": true` in `compilerOptions`. [Read more.](https://github.com/honojs/hono/issues/2270#issuecomment-2143745118) 10 11 [!NOTE] 12 For the RPC types to work properly in a monorepo, in both the Client's and Server's tsconfig.json files, set `"strict": true` in `compilerOptions`. [Read more.](https://github.com/honojs/hono/issues/2270#issuecomment-2143745118) 13 14 ## Available Resources 15 16 ### Quick Start 17 18 ### Features 19 20 ### Use-cases 21 22 ### Who is using Hono? 23 24 - **Drivly** 25 - URL: https://driv.ly/ 26 27 - **repeat.dev** 28 - URL: https://repeat.dev/ 29 30 ### Hono in 1 minute 31 32 ### Ultrafast 33 34 ### Lightweight 35 36 ### Multiple routers 37 38 ### Web Standards 39 40 ### Middleware & Helpers 41 42 - **Basic Authentication** 43 - URL: /docs/middleware/builtin/basic-auth 44 45 - **Bearer Authentication** 46 - URL: /docs/middleware/builtin/bearer-auth 47 48 - **Body Limit** 49 - URL: /docs/middleware/builtin/body-limit 50 51 - **Cache** 52 - URL: /docs/middleware/builtin/cache 53 54 - **Compress** 55 - URL: /docs/middleware/builtin/compress 56 57 - **Context Storage** 58 - URL: /docs/middleware/builtin/context-storage 59 60 - **Cookie** 61 - URL: /docs/helpers/cookie 62 63 - **CORS** 64 - URL: /docs/middleware/builtin/cors 65 66 - **ETag** 67 - URL: /docs/middleware/builtin/etag 68 69 - **html** 70 - URL: /docs/helpers/html 71 72 - **JSX** 73 - URL: /docs/guides/jsx 74 75 - **JWT Authentication** 76 - URL: /docs/middleware/builtin/jwt 77 78 - **Logger** 79 - URL: /docs/middleware/builtin/logger 80 81 - **Language** 82 - URL: /docs/middleware/builtin/language 83 84 - **Pretty JSON** 85 - URL: /docs/middleware/builtin/pretty-json 86 87 - **Secure Headers** 88 - URL: /docs/middleware/builtin/secure-headers 89 90 - **SSG** 91 - URL: /docs/helpers/ssg 92 93 - **Streaming** 94 - URL: /docs/helpers/streaming 95 96 - **GraphQL Server** 97 - URL: https://github.com/honojs/middleware/tree/main/packages/graphql-server 98 99 - **Firebase Authentication** 100 - URL: https://github.com/honojs/middleware/tree/main/packages/firebase-auth 101 102 - **Sentry** 103 - URL: https://github.com/honojs/middleware/tree/main/packages/sentry 104 105 ### Developer Experience 106 107 ### Throwing HTTPExceptions 108 109 ### Handling HTTPExceptions 110 111 ### param() 112 113 ### query() 114 115 ### queries() 116 117 ### header() 118 119 ### parseBody() 120 121 ### json() 122 123 ### text() 124 125 ### arrayBuffer() 126 127 ### blob() 128 129 ### formData() 130 131 ### valid() 132 133 ### routePath 134 135 ### matchedRoutes 136 137 ### path 138 139 ### url 140 141 ### method 142 143 ### raw 144 145 ### cloneRawRequest() 146 147 ### req 148 149 ### status() 150 151 ### header() 152 153 ### body() 154 155 ### text() 156 157 ### json() 158 159 ### html() 160 161 ### notFound() 162 163 ### redirect() 164 165 ### res 166 167 ### set() / get() 168 169 ### var 170 171 ### render() / setRenderer() 172 173 ### executionCtx 174 175 ### event 176 177 ### env 178 179 ### error 180 181 ### ContextVariableMap 182 183 ### Basic 184 185 ### Path Parameter 186 187 ### Regexp 188 189 ### Including slashes 190 191 ### Chained route 192 193 ### Grouping 194 195 ### Grouping without changing base 196 197 ### Base path 198 199 ### Routing with hostname 200 201 ### Routing with `host` Header value 202 203 ### Routing priority 204 205 ### Grouping ordering 206 207 ### Methods 208 209 ### Not Found 210 211 ### Error Handling 212 213 ### fire() 214 215 ### fetch() 216 217 ### request() 218 219 ### mount() 220 221 ### strict mode 222 223 ### router option 224 225 ### Generics 226 227 ### `hono` 228 229 ### `hono/quick` 230 231 ### `hono/tiny` 232 233 ### Which preset should I use? 234 235 ### Is there an official Renovate config for Hono? 236 237 ### Contributing 238 239 ### Sponsoring 240 241 - **Sponsor @yusukebe on GitHub Sponsors** 242 - URL: https://github.com/sponsors/yusukebe 243 244 - **Sponsor @usualoma on GitHub Sponsors** 245 - URL: https://github.com/sponsors/usualoma 246 247 ### Other Resources 248 249 - **Link**: GitHub repository: <a href=" 250 - URL: https://github.com/honojs">https://github.com/honojs</a> 251 252 - **Link**: npm registry: <a href=" 253 - URL: https://www.npmjs.com/package/hono">https://www.npmjs.com/package/hono</a> 254 255 - **Link**: JSR: <a href=" 256 - URL: https://jsr.io/@hono/hono">https://jsr.io/@hono/hono</a> 257 258 ### Settings 259 260 ### Usage 261 262 ### Metadata hoisting 263 264 ### Fragment 265 266 ### `PropsWithChildren` 267 268 ### Inserting Raw HTML 269 270 ### Memoization 271 272 ### Context 273 274 ### Async Component 275 276 ### Suspense <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 277 278 ### ErrorBoundary <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 279 280 ### StreamingContext <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 281 282 ### Integration with html Middleware 283 284 ### With JSX Renderer Middleware 285 286 ### Override type definitions 287 288 ### Available Helpers 289 290 - **Accepts** 291 - URL: /docs/helpers/accepts 292 293 - **Adapter** 294 - URL: /docs/helpers/adapter 295 296 - **Cookie** 297 - URL: /docs/helpers/cookie 298 299 - **css** 300 - URL: /docs/helpers/css 301 302 - **Dev** 303 - URL: /docs/helpers/dev 304 305 - **Factory** 306 - URL: /docs/helpers/factory 307 308 - **html** 309 - URL: /docs/helpers/html 310 311 - **JWT** 312 - URL: /docs/helpers/jwt 313 314 - **SSG** 315 - URL: /docs/helpers/ssg 316 317 - **Streaming** 318 - URL: /docs/helpers/streaming 319 320 - **Testing** 321 - URL: /docs/helpers/testing 322 323 - **WebSocket** 324 - URL: /docs/helpers/websocket 325 326 ### Definition of Middleware 327 328 ### Execution order 329 330 ### Built-in Middleware 331 332 ### Custom Middleware 333 334 ### Context access inside Middleware arguments 335 336 ### Third-party Middleware 337 338 ### Request and Response 339 340 ### Env 341 342 ### Manual validator 343 344 ### Multiple validators 345 346 ### With Zod 347 348 ### Zod Validator Middleware 349 350 ### Standard Schema Validator Middleware 351 352 ### Counter example 353 354 ### `render()` 355 356 ### Hooks compatible with React 357 358 ### `startViewTransition()` family 359 360 - **the `finish` promise becomes fulfilled** 361 - URL: https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/finished 362 363 ### The `hono/jsx/dom` runtime 364 365 ### Server 366 367 ### Client 368 369 ### Status code 370 371 ### Global Response 372 373 ### Not Found 374 375 ### Path parameters 376 377 ### Headers 378 379 ### `init` option 380 381 ### `$url()` 382 383 ### `$path()` 384 385 ### File Uploads 386 387 ### Custom `fetch` method 388 389 ### Custom query serializer 390 391 ### Infer 392 393 ### Parsing a Response with type-safety helper 394 395 ### Using SWR 396 397 ### Using RPC with larger applications 398 399 ### Known issues 400 401 ### Don't make "Controllers" when possible 402 403 ### `factory.createHandlers()` in `hono/factory` 404 405 ### Building a larger application 406 407 ### HEAD Request Best Practices 408 409 ### Passing arguments: 410 411 ### Commonly used arguments 412 413 ### Example flows 414 415 ### Troubleshooting & tips 416 417 ### Links & references 418 419 - **create-hono** 420 - URL: https://github.com/honojs/create-hono 421 422 ### Usage 423 424 ### toSSG 425 426 ### Generate File 427 428 ### Middleware 429 430 ### Plugins 431 432 ### Import 433 434 ### `sign()` 435 436 ### `verify()` 437 438 ### `decode()` 439 440 ### Payload Validation 441 442 ### Custom Error Types 443 444 ### Supported AlgorithmTypes 445 446 ### `getRouterName()` 447 448 ### `showRoutes()` 449 450 ### Options 451 452 ### Import 453 454 ### Usage 455 456 ### Options 457 458 ### `__Secure-` and `__Host-` prefix 459 460 ### Following the best practices 461 462 - **RFC6265bis-13** 463 - URL: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13 464 465 - **CHIPS-01** 466 - URL: https://www.ietf.org/archive/id/draft-cutler-httpbis-partitioned-cookies-01.html 467 468 ### Import 469 470 ### `upgradeWebSocket()` 471 472 ### RPC-mode 473 474 ### Examples 475 476 ### Import 477 478 ### `testClient()` 479 480 ### Import 481 482 ### `createFactory()` 483 484 ### `createMiddleware()` 485 486 ### `factory.createHandlers()` 487 488 ### `factory.createApp()` 489 490 ### Import 491 492 ### `stream()` 493 494 ### `streamText()` 495 496 ### `streamSSE()` 497 498 ### Error Handling 499 500 ### Import 501 502 ### `env()` 503 504 - **`Deno.env`** 505 - URL: https://docs.deno.com/runtime/manual/basics/env_variables 506 507 - **`Bun.env`** 508 - URL: https://bun.com/guides/runtime/set-env 509 510 - **Environment Variables on Vercel** 511 - URL: https://vercel.com/docs/projects/environment-variables 512 513 - **Environment Variables on AWS Lambda** 514 - URL: https://docs.aws.amazon.com/lambda/latest/dg/samples-blank.html#samples-blank-architecture 515 516 - **not supported** 517 - URL: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html 518 519 - **Netlify Contexts** 520 - URL: https://docs.netlify.com/site-deploys/overview/#deploy-contexts 521 522 ### `getRuntimeKey()` 523 524 ### Import 525 526 ### Usage 527 528 ### Type Definitions 529 530 ### Import 531 532 ### Usage 533 534 ### `matchedRoutes()` 535 536 ### `routePath()` 537 538 ### `baseRoutePath()` 539 540 ### `basePath()` 541 542 ### Import 543 544 ### `accepts()` 545 546 ### Options 547 548 ### Import 549 550 ### `html` 551 552 ### `raw()` 553 554 ### Tips 555 556 - **Link**: < 557 - URL: https://marketplace.visualstudio.com/items?itemName=bierner.lit-html> 558 559 - **Link**: < 560 - URL: https://github.com/MaxMEllon/vim-jsx-pretty> 561 562 ### Import 563 564 ### `proxy()` 565 566 ### Import 567 568 ### `css` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 569 570 ### `keyframes` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 571 572 ### `cx` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 573 574 ### Usage in combination with [Secure Headers](/docs/middleware/builtin/secure-headers) middleware 575 576 ### `createCssContext` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 577 578 ### Security 579 580 ### Tips 581 582 ### Routers 583 584 ### Cloudflare Workers 585 586 - **benchmarks/handle-event** 587 - URL: https://github.com/honojs/hono/tree/main/benchmarks/handle-event 588 589 ### Deno 590 591 - **benchmarks/deno** 592 - URL: https://github.com/honojs/hono/tree/main/benchmarks/deno 593 594 - **Link**: Method: `bombardier --fasthttp -d 10s -c 100 ' 595 - URL: http://localhost:8000/user/lookup/username/foo'` 596 597 ### Bun 598 599 - **SaltyAom/bun-http-framework-benchmark** 600 - URL: https://github.com/SaltyAom/bun-http-framework-benchmark 601 602 ### RegExpRouter 603 604 ### TrieRouter 605 606 ### SmartRouter 607 608 ### LinearRouter 609 610 ### PatternRouter 611 612 ### Motivation 613 614 ### RPC 615 616 - **Zod** 617 - URL: https://zod.dev 618 619 - **Zod Validator Middleware** 620 - URL: https://github.com/honojs/middleware/tree/main/packages/zod-validator 621 622 ### Writing API 623 624 ### Validation with Zod 625 626 ### Sharing the Types 627 628 ### Client 629 630 ### With React 631 632 ### 1. Setup 633 634 ### 2. Hello World 635 636 ### 3. Run 637 638 - **Link**: Make a GET request using cURL or Postman to ` 639 - URL: http://127.0.0.1:54321/functions/v1/hello-world/hello`: 640 641 ### 4. Deploy 642 643 ### 1. Install CLI 644 645 - **Install the Azure Functions Core Tools | Microsoft Learn** 646 - URL: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-typescript?pivots=nodejs-model-v4#install-the-azure-functions-core-tools 647 648 ### 2. Setup 649 650 ### 3. Hello World 651 652 ### 4. Run 653 654 ### 5. Deploy 655 656 ### 1. Setup 657 658 ### 2. Hello World 659 660 ### 3. Deploy 661 662 ### Serve Binary data 663 664 ### Access AWS Lambda Object 665 666 ### Access RequestContext 667 668 ### Lambda response streaming 669 670 ### 1. Install Bun 671 672 ### 2. Setup 673 674 ### 3. Hello World 675 676 ### 4. Run 677 678 ### Change port number 679 680 ### Serve static files 681 682 ### Testing 683 684 ### 1. Setup 685 686 ### 2. Hello World 687 688 ### 3. Run 689 690 ### 4. Deploy 691 692 - **Cloudflare dashboard** 693 - URL: https://dash.cloudflare.com 694 695 ### Bindings 696 697 ### Client-side 698 699 ### Cloudflare Pages Middleware 700 701 ### 1. Setup 702 703 ### 2. Hello World 704 705 ### 3. Run 706 707 ### Change port number 708 709 ### WebSocket 710 711 ### Access the raw Node.js APIs 712 713 ### Serve static files 714 715 ### http2 716 717 ### Building & Deployment 718 719 ### 1. Setup 720 721 ### 2. Hello World 722 723 ### 3. Setup serverless-devs 724 725 ### 4. Deploy 726 727 ### 1. Setup 728 729 ### 2. Hello World 730 731 ### 3. Run 732 733 ### 4. Deploy 734 735 ### Pages Router 736 737 ### 1. Setup 738 739 ### 2. Hello World 740 741 ### 3. Run 742 743 ### 4. Deploy 744 745 ### Using Hono with other event handlers 746 747 ### Serve static files 748 749 ### Types 750 751 ### Testing 752 753 ### Bindings 754 755 ### Using Variables in Middleware 756 757 ### Deploy from GitHub Actions 758 759 ### Load env when local development 760 761 ### 1. Setup 762 763 ### 2. Hello World 764 765 ### 3. Run 766 767 ### 4. Deploy 768 769 ### Further reading 770 771 ### 1. Setup 772 773 ### 2. Hello World 774 775 ### 3. Run 776 777 ### 4. Deploy 778 779 ### Bindings 780 781 ### 1. Setup 782 783 ### 2. Hello World 784 785 ### 3. Deploy 786 787 ### Callback 788 789 ### 1. Setup 790 791 ### 2. Hello World 792 793 ### 3. Run 794 795 ### 4. Deploy 796 797 ### `Context` 798 799 ### 1. Install Deno 800 801 ### 2. Setup 802 803 ### 3. Hello World 804 805 ### 4. Run 806 807 ### Change port number 808 809 ### Serve static files 810 811 ### Deno Deploy 812 813 ### Testing 814 815 ### npm and JSR 816 817 ### 1. Setup 818 819 ### 2. Set up WIT interface & dependencies 820 821 ### 3. Hello Wasm 822 823 ### 4. Build 824 825 ### 5. Run 826 827 ### More information 828 829 - **Bytecode Alliance Zulip** 830 - URL: https://bytecodealliance.zulipchat.com 831 832 - **Jco repository** 833 - URL: https://github.com/bytecodealliance/jco 834 835 - **componentize-js repository** 836 - URL: https://github.com/bytecodealliance/componentize-js 837 838 ### Starter 839 840 ### Hello World 841 842 ### Return JSON 843 844 ### Request and Response 845 846 ### Return HTML 847 848 ### Return raw Response 849 850 ### Using Middleware 851 852 ### Adapter 853 854 ### Next step 855 856 ### 1. Setup 857 858 ### 2. Hello World 859 860 ### 3. Run 861 862 ### 1. Install the CLI 863 864 ### 2. Project setup 865 866 ### 3. Hello World 867 868 ### 4. Deploy 869 870 ### Changing runtimes 871 872 - **Node.js** 873 - URL: /docs/getting-started/nodejs#building-deployment 874 875 - **Bun** 876 - URL: https://bun.com/guides/ecosystem/docker 877 878 - **Deno** 879 - URL: https://docs.deno.com/examples/google_cloud_run_tutorial 880 881 - **Auth.js(Next Auth)** 882 - URL: https://github.com/honojs/middleware/tree/main/packages/auth-js 883 884 - **Casbin** 885 - URL: https://github.com/honojs/middleware/tree/main/packages/casbin 886 887 - **Clerk Auth** 888 - URL: https://github.com/honojs/middleware/tree/main/packages/clerk-auth 889 890 - **Cloudflare Access** 891 - URL: https://github.com/honojs/middleware/tree/main/packages/cloudflare-access 892 893 - **OAuth Providers** 894 - URL: https://github.com/honojs/middleware/tree/main/packages/oauth-providers 895 896 - **OIDC Auth** 897 - URL: https://github.com/honojs/middleware/tree/main/packages/oidc-auth 898 899 - **Firebase Auth** 900 - URL: https://github.com/honojs/middleware/tree/main/packages/firebase-auth 901 902 - **Verify RSA JWT (JWKS)** 903 - URL: https://github.com/wataruoguchi/verify-rsa-jwt-cloudflare-worker 904 905 - **Stytch Auth** 906 - URL: https://github.com/honojs/middleware/tree/main/packages/stytch-auth 907 908 - **Ajv Validator** 909 - URL: https://github.com/honojs/middleware/tree/main/packages/ajv-validator 910 911 - **ArkType Validator** 912 - URL: https://github.com/honojs/middleware/tree/main/packages/arktype-validator 913 914 - **Class Validator** 915 - URL: https://github.com/honojs/middleware/tree/main/packages/class-validator 916 917 - **Conform Validator** 918 - URL: https://github.com/honojs/middleware/tree/main/packages/conform-validator 919 920 - **Effect Schema Validator** 921 - URL: https://github.com/honojs/middleware/tree/main/packages/effect-validator 922 923 - **Standard Schema Validator** 924 - URL: https://github.com/honojs/middleware/tree/main/packages/standard-validator 925 926 - **TypeBox Validator** 927 - URL: https://github.com/honojs/middleware/tree/main/packages/typebox-validator 928 929 - **Typia Validator** 930 - URL: https://github.com/honojs/middleware/tree/main/packages/typia-validator 931 932 - **unknownutil Validator** 933 - URL: https://github.com/ryoppippi/hono-unknownutil-validator 934 935 - **Valibot Validator** 936 - URL: https://github.com/honojs/middleware/tree/main/packages/valibot-validator 937 938 - **Zod Validator** 939 - URL: https://github.com/honojs/middleware/tree/main/packages/zod-validator 940 941 - **Zod OpenAPI** 942 - URL: https://github.com/honojs/middleware/tree/main/packages/zod-openapi 943 944 - **Scalar** 945 - URL: https://github.com/scalar/scalar/tree/main/integrations/hono 946 947 - **Swagger UI** 948 - URL: https://github.com/honojs/middleware/tree/main/packages/swagger-ui 949 950 - **Swagger Editor** 951 - URL: https://github.com/honojs/middleware/tree/main/packages/swagger-editor 952 953 - **Hono OpenAPI** 954 - URL: https://github.com/rhinobase/hono-openapi 955 956 - **hono-zod-openapi** 957 - URL: https://github.com/paolostyle/hono-zod-openapi 958 959 - **ESLint Config** 960 - URL: https://github.com/honojs/middleware/tree/main/packages/eslint-config 961 962 - **SSG Plugin Essential** 963 - URL: https://github.com/honojs/middleware/tree/main/packages/ssg-plugins-essential 964 965 - **Apitally (API monitoring & analytics)** 966 - URL: https://docs.apitally.io/frameworks/hono 967 968 - **Highlight.io** 969 - URL: https://www.highlight.io/docs/getting-started/backend-sdk/js/hono 970 971 - **LogTape (Logging)** 972 - URL: https://logtape.org/manual/integrations#hono 973 974 - **OpenTelemetry** 975 - URL: https://github.com/honojs/middleware/tree/main/packages/otel 976 977 - **Prometheus Metrics** 978 - URL: https://github.com/honojs/middleware/tree/main/packages/prometheus 979 980 - **Sentry** 981 - URL: https://github.com/honojs/middleware/tree/main/packages/sentry 982 983 - **Pino logger** 984 - URL: https://github.com/maou-shonen/hono-pino 985 986 - **GraphQL Server** 987 - URL: https://github.com/honojs/middleware/tree/main/packages/graphql-server 988 989 - **oRPC** 990 - URL: https://orpc.dev/docs/adapters/hono 991 992 - **tRPC Server** 993 - URL: https://github.com/honojs/middleware/tree/main/packages/trpc-server 994 995 - **Bun Transpiler** 996 - URL: https://github.com/honojs/middleware/tree/main/packages/bun-transpiler 997 998 - **esbuild Transpiler** 999 - URL: https://github.com/honojs/middleware/tree/main/packages/esbuild-transpiler 1000 1001 - **Qwik City** 1002 - URL: https://github.com/honojs/middleware/tree/main/packages/qwik-city 1003 1004 - **React Compatibility** 1005 - URL: https://github.com/honojs/middleware/tree/main/packages/react-compat 1006 1007 - **React Renderer** 1008 - URL: https://github.com/honojs/middleware/tree/main/packages/react-renderer 1009 1010 - **GlideMQ (Message Queue REST API + SSE)** 1011 - URL: https://github.com/avifenesh/glidemq-hono 1012 1013 - **Intlayer i18n** 1014 - URL: https://intlayer.org/doc/environment/hono 1015 1016 - **Bun Compress** 1017 - URL: https://github.com/honojs/middleware/tree/main/packages/bun-compress 1018 1019 - **Cap Checkpoint** 1020 - URL: https://capjs.js.org/guide/middleware/hono.html 1021 1022 - **Event Emitter** 1023 - URL: https://github.com/honojs/middleware/tree/main/packages/event-emitter 1024 1025 - **Geo** 1026 - URL: https://github.com/ktkongtong/hono-geo-middleware/tree/main/packages/middleware 1027 1028 - **Hono Rate Limiter** 1029 - URL: https://github.com/rhinobase/hono-rate-limiter 1030 1031 - **Hono Problem Details (RFC 9457)** 1032 - URL: https://github.com/paveg/hono-problem-details 1033 1034 - **Hono Simple DI** 1035 - URL: https://github.com/maou-shonen/hono-simple-DI 1036 1037 - **InferDI** 1038 - URL: https://github.com/inferdi/inferdi/tree/main/packages/hono 1039 1040 - **Idempotency (Stripe-style idempotency keys)** 1041 - URL: https://github.com/paveg/hono-idempotency 1042 1043 - **idempot-js** 1044 - URL: https://js.idempot.dev 1045 1046 - **jsonv-ts (Validator, OpenAPI, MCP)** 1047 - URL: https://github.com/dswbx/jsonv-ts 1048 1049 - **MCP** 1050 - URL: https://github.com/honojs/middleware/tree/main/packages/mcp 1051 1052 - **RONIN (Database)** 1053 - URL: https://github.com/ronin-co/hono-client 1054 1055 - **Session** 1056 - URL: https://github.com/honojs/middleware/tree/main/packages/session 1057 1058 - **tsyringe** 1059 - URL: https://github.com/honojs/middleware/tree/main/packages/tsyringe 1060 1061 - **User Agent based Blocker** 1062 - URL: https://github.com/honojs/middleware/tree/main/packages/ua-blocker 1063 1064 ### Import 1065 1066 ### Usage 1067 1068 ### Options 1069 1070 ### Platform specific Request IDs 1071 1072 - **AWS documentation: Context object** 1073 - URL: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html 1074 1075 - **Cloudflare Ray ID 1076 ** 1077 - URL: https://developers.cloudflare.com/fundamentals/reference/cloudflare-ray-id/ 1078 1079 - **Request ID on the Deno Blog** 1080 - URL: https://deno.com/blog/zero-config-debugging-deno-opentelemetry#:~:text=s%20automatically%20have-,unique%20request%20IDs,-associated%20with%20them 1081 1082 - **Fastly documentation: req.xid** 1083 - URL: https://www.fastly.com/documentation/reference/vcl/variables/client-request/req-xid/ 1084 1085 ### Import 1086 1087 ### Usage 1088 1089 ### tryGetContext 1090 1091 ### Import 1092 1093 ### Usage 1094 1095 ### Options 1096 1097 ### Usage with Bun for large requests 1098 1099 ### Import 1100 1101 ### Usage 1102 1103 ### Supported Options 1104 1105 ### Middleware Conflict 1106 1107 ### Setting Content-Security-Policy 1108 1109 ### Setting Permission-Policy 1110 1111 ### Import 1112 1113 ### Usage 1114 1115 ### Options 1116 1117 ### Environment-dependent CORS configuration 1118 1119 ### Using with Vite 1120 1121 ### Import 1122 1123 ### Usage 1124 1125 ### Logging Details 1126 1127 ### PrintFunc 1128 1129 ### Options 1130 1131 ### Import 1132 1133 ### Usage 1134 1135 ### Options 1136 1137 ### Import 1138 1139 ### Usage 1140 1141 ### Options 1142 1143 ### Import 1144 1145 ### Usage 1146 1147 ### Options 1148 1149 ### Import 1150 1151 ### Usage 1152 1153 ### For example 1154 1155 ### Options 1156 1157 ### Import 1158 1159 ### Usage 1160 1161 ### The retained headers 1162 1163 ### Options 1164 1165 ### Import 1166 1167 ### Usage 1168 1169 ### Import 1170 1171 ### Usage 1172 1173 ### Options 1174 1175 ### More Options 1176 1177 ### Recipes 1178 1179 ### Import 1180 1181 ### Usage 1182 1183 ### Options 1184 1185 ### Nested Layouts 1186 1187 ### `useRequestContext()` 1188 1189 ### Extending `ContextRenderer` 1190 1191 ### Import 1192 1193 ### Usage 1194 1195 ### Options 1196 1197 ### Note 1198 1199 ### Import 1200 1201 ### Usage 1202 1203 ### Notes 1204 1205 ### Middleware Conflicts 1206 1207 ### Import 1208 1209 ### Usage 1210 1211 ### Options 1212 1213 ### Import 1214 1215 ### Basic Usage 1216 1217 ### Default Configuration 1218 1219 ### Key Behaviors 1220 1221 ### Advanced Configuration 1222 1223 ### Options Reference 1224 1225 ### Validation & Error Handling 1226 1227 ### Common Recipes 1228 1229 ### Import 1230 1231 ### Usage 1232 1233 ### Options 1234 1235 ### What this middleware validates 1236 1237 ### Import 1238 1239 ### Usage 1240 1241 ### Using `verifyWithJwks` outside of middleware 1242 1243 ### Configuring JWKS fetch request options 1244 1245 ### Options 1246 1247 ### Import 1248 1249 ### Usage 1250 1251 ### Rules 1252 1253 ### Error handling 1254 1255 ### Import 1256 1257 ### Usage 1258 1259 ### Result 1260 1261 ### Options 1262 1263 ### Import 1264 1265 ### Usage 1266 1267 ### Options 1268 1269 - **Link**: **`string`**: Single allowed origin (e.g., `' 1270 - URL: https://example.com'`) 1271 1272 ## Additional Resources (Optional) 1273 1274 ### Optional Parameter 1275 1276 ## How to Use This Skill 1277 1278 Reference these resources when working with CSRF Protection.
hk-vk/skills commit b605494f20
Frequently asked questions How do I install the Csrf Protection skill? Run npx get-skill add hk-vk/csrf-protection in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Csrf Protection skill do? Csrf Protection It is listed under Coding & Dev Tools on SkillMD.
Is Csrf Protection safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Csrf Protection? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Csrf Protection free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Csrf Protection? hk-vk (@hk-vk) published this skill. Their other Agent Skills are listed on their SkillMD profile.