mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 20:05:09 +01:00
2.9 KiB
2.9 KiB
Setting up the proxy
Our proxy is used to bypass CORS-protected URLs on the client side, allowing users to make requests to protected endpoints without a backend server.
The proxy is made using Nitro by UnJS which supports building the proxy to work on multiple providers including Cloudflare Workers, AWS Lambda and more...
Our recommended provider is Cloudflare due to its generous free plan.
Cloudflare Workers
The proxy is made as a Cloudflare worker. Cloudflare has a generous free plan, so you don't need to pay anything unless you get hundreds of users.
- Create a GitHub account at https://github.com if you don't have one.
- Click the "Deploy with workers" button above.
- Click the "Authorize Workers" button to authorise Cloudflare to talk to GitHub.
- Authorize Cloudflare Workers in the GitHub page that pops up.
- Follow the instructions to configure your Cloudflare account. Select "I have an account" if you have a Cloudflare account already, otherwise follow the link to create one.
- Click the link to "Workers Dashboard" to find your account ID.
- If you have used workers in the past, there will be a place on the right hand side to copy your account ID.
- If you haven't used workers before, you can copy your account ID from the URL e.g. https://dash.cloudflare.com/ab7cb454c93987b6343350d4e84c16c7/workers-and-pages/create where
ab7cb454c93987b6343350d4e84c16c7
is the account ID. - Paste the account ID into the text box on the original Cloudflare workers page.
- Click the link to "My Profile" to create an API token.
- Click "Create Token".
- Select "Use template" next to "Edit Cloudflare Workers".
- Under "Account Resources", select "Include" and your account under the dropdown.
- Under "Zone Resources", select "All zones" (You can select a more specific zone if you have the zones available).
- At the bottom of the page, click "Continue to summary".
- On the next screen, click "Create token".
- Copy the API token and save it in a safe place, it won't be shown again.
- Paste the API token into the Cloudflare Workers API Token text box.
- Click "Fork the Repository" and follow the instructions to enable workflows.
- Click "Deploy" to deploy to Cloudflare Workers.
- Congratulations! Your worker is now deploying. Please wait for the GitHub Action to build and publish your worker.
- You can click the "Worker dash" and "GitHub repo" buttons to see the status of the deploy.
- When the worker has deployed, you will need to take note of the URL. This can be found on Cloudflare under Workers and Pages -> Overview -> proxy.