Skip to content

gateway-router just insure all gateway traffic are going to proper routes and reject the rest

Notifications You must be signed in to change notification settings

MJ-API-Development/gateway-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EOD Stock API - Cloudflare Workers API Gateway Router

The router is designed to proxy requests through Cloudflare for certain paths, while returning a 404 Not Found response for other paths.

Functionality

The router is set up to allow requests to the following paths:

  • /api
  • /redoc
  • /docs
  • /_admin
  • /open-api

For requests to these paths, the router will proxy the request through Cloudflare. Requests to other paths will result in a 404 Not Found response.

Additionally, if the request is for the home route ("/"), the router will redirect the request to the /redoc path.

Usage

To use this Cloudflare Workers Gateway router, copy the code from this file and paste it into your Cloudflare Workers script.

Once you have pasted the code into your script, you can customize the allowed paths as needed by modifying the allowedPaths array.

Note that to modify request headers, you will need to use Cloudflare rules.

Error Handling

If there is an error when routing a request, the router will return a 500 Internal Server Error response with the message "There was a problem routing your request".

Community

About

gateway-router just insure all gateway traffic are going to proper routes and reject the rest

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published