logo
0
0
WeChat Login
feat: 更新 README.md 和 edge-functions 以支持 GITHUB_ORIGIN 配置和错误处理

EdgeOne Pages GitHub Pages Reverse Proxy

This project is a minimal EdgeOne Pages site that reverse proxies a GitHub Pages origin through an Edge Function.

How it works

All requests are handled by edge-functions/[[default]].js, which forwards traffic to the GitHub Pages origin configured in GITHUB_ORIGIN.

Setup

  1. Set the environment variable GITHUB_ORIGIN in EdgeOne Pages.
  2. Use the full GitHub Pages origin, for example:
    • https://yourname.github.io
    • or https://yourname.github.io/your-repo if the site lives in a subpath
  3. Deploy the site to EdgeOne Pages.

Notes

  • The proxy rewrites upstream redirect Location headers back to your EdgeOne domain.
  • GET and HEAD responses receive a default edge cache header when the origin does not provide one.
  • For the best result, keep your GitHub Pages site using relative asset URLs when possible.

Local development

Use the EdgeOne Pages CLI for local development:

export GITHUB_ORIGIN="https://yourname.github.io" # or: https://yourname.github.io/your-repo edgeone pages dev

If GITHUB_ORIGIN is missing, function routes return 500 Missing GITHUB_ORIGIN....

If / returns an XML UserCnameInvalid response in local dev, ensure the root route is handled by edge-functions/index.js.

If you want me to wire this to a specific GitHub Pages URL and prepare the deployment flow, share the origin URL and whether you want the China or Global EdgeOne site.

About

基于边缘函数的反向代理

Language
JavaScript100%