Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyb3r-jak3/cf-example-cors-application
Example for CORs on two sites using Cloudflare access
https://github.com/cyb3r-jak3/cf-example-cors-application
Last synced: about 4 hours ago
JSON representation
Example for CORs on two sites using Cloudflare access
- Host: GitHub
- URL: https://github.com/cyb3r-jak3/cf-example-cors-application
- Owner: Cyb3r-Jak3
- License: mit
- Created: 2023-12-13T02:05:08.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-04-02T01:15:55.000Z (8 months ago)
- Last Synced: 2024-04-02T02:29:27.690Z (8 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare CORS ACCESS
Example of how to use CORS with Cloudflare access to pass credentials to a backend.
Replace all `.community.cyberjake.xyz` with your domain.Need the following:
Cloudflare Policies:
- ![Cloudflare CORS policy](https://r2-sharex.cyberjake.xyz/file/2024/03/firefox_DawNag6jI1.png)
- ![Cloudflare Access Application](https://r2-sharex.cyberjake.xyz/file/2024/03/firefox_AG7WxYmBLC.png)### Backend:
Cloudflare tunnel token with public hostnames as shown below.
![Cloudflare Tunnel Public Hostnames](https://r2-sharex.cyberjake.xyz/file/2023/12/firefox_IRs6LwK788.png)Edit the cors settings in [backend/index.js](backend/index.js) to match your origin.
### Frontend:
Edit the `server_name` in [frontend/nginx.conf](frontend/nginx.conf) to match your domain.
### Running:
```bash
docker compose up --build
```Wait for the tunnel to connect and then visit `https:///` to see the frontend and watch the console for the response from the backend.
## Demo
View the demo at [https://frontend.community.cyberjake.xyz/](https://frontend.community.cyberjake.xyz/).
#### Demo Notes
- It does require to verify with an email address to access the site.
- I am able to see emails that sign up, so please don't use any sensitive information. You can use a temporary email service like [Temp Mail](https://temp-mail.org/) to get a temporary email address.