1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-22 14:57:40 +01:00
smov/.docs/content/2.self-hosting/2.proxy.md

37 lines
2.7 KiB
Markdown
Raw Normal View History

# 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](https://nitro.unjs.io/) which supports building the proxy to work on multiple providers including Cloudflare Workers, AWS Lambda and [more...](https://nitro.unjs.io/deploy)
Our recommended provider is Cloudflare due to its [generous free plan](https://www.cloudflare.com/en-gb/plans/developer-platform/).
## 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.
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/movie-web/simple-proxy)
1. Create a GitHub account at https://github.com if you don't have one.
1. Click the "Deploy with workers" button above.
1. Click the "Authorize Workers" button to authorise Cloudflare to talk to GitHub.
1. Authorize Cloudflare Workers in the GitHub page that pops up.
1. 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.
1. Click the link to "Workers Dashboard" to find your account ID.
1. If you have used workers in the past, there will be a place on the right hand side to copy your account ID.
1. 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.
1. Paste the account ID into the text box on the original Cloudflare workers page.
1. Click the link to "My Profile" to create an API token.
1. Click "Create Token".
1. Select "Use template" next to "Edit Cloudflare Workers".
1. Under "Account Resources", select "Include" and your account under the dropdown.
1. Under "Zone Resources", select "All zones" (You can select a more specific zone if you have the zones available).
1. At the bottom of the page, click "Continue to summary".
1. On the next screen, click "Create token".
1. Copy the API token and **save it in a safe place, it won't be shown again**.
1. Paste the API token into the Cloudflare Workers API Token text box.
1. Click "Fork the Repository" and follow the instructions to enable workflows.
1. Click "Deploy" to deploy to Cloudflare Workers.
1. Congratulations! Your worker is now deploying. Please wait for the GitHub Action to build and publish your worker.
1. You can click the "Worker dash" and "GitHub repo" buttons to see the status of the deploy.