Skip to content

fry69/cloudflare-mta-sts-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare MTA-STS policy via static assets

This is a simple example how to serve MTA-STS policy file

.well-known/mta-sts.txt

as a static Cloudflare asset for multiple domains. Static only assets do not count against your Wokers usage, they are completely free.

Static assets are a new Cloudflare feature, see documentation

Prerequisites

Installation

  1. Clone this repository:

    git clone https://github.com/fry69/cloudflare-mta-sts-static.git
    cd cloudflare-mta-sts-static
    
  2. Install dependencies:

    npm install
    
  3. Configure your Cloudflare account in Wrangler:

    wrangler login
    
  4. Optionally update the wrangler.toml file with your custom domains:

    routes = [
      { pattern = "mta-sts.example1.com", custom_domain = true },
      { pattern = "mta-sts.example2.com", custom_domain = true }
    ]
    

Usage

  1. Develop and test locally:

    npm run dev
    
  2. Deploy to Cloudflare Workers:

    npm run deploy
    
  3. Add a custom domain in your Cloudflare dashboard to direct traffic to this asset only worker or add custom domains in wrangler.toml as described above.

Customization

Edit the policy file in

public/.well-known/mta-sts.txt

conforming to RFC 8641

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support

If you encounter any problems or have any questions, please open an issue in this repository.

About

Serve MTA-STS policy file via Cloudflare static assets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published