A simple URL forwarding service for .test domains, built on Cloudflare Workers. Similar to fwd.host by the
Laravel Herd team, this service helps with OAuth callbacks during local development.
When developing locally with .test domains (like Laravel Herd), OAuth providers often reject callback URLs containing
.test domains because they require public top-level domains. forward.direct solves this by acting as a public proxy
that redirects OAuth callbacks to your local development environment.
Yes, fwd.host by the Laravel Herd team is excellent! However, we created forward.direct to solve a specific compatibility issue.
The Problem: Some OAuth providers (notably Spotify) don't support callback URLs with double protocols like:
https://fwd.host/https://myapp.test/auth/callback
Spotify's OAuth configuration interface rejects URLs containing https:// twice, making fwd.host incompatible with
Spotify OAuth integration.
Our Solution: forward.direct makes the protocol optional. You can use:
https://forward.direct/myapp.test/auth/callback
This automatically defaults to HTTP (which is what most local development uses anyway, if not your app will most likely upgrade the request to HTTPS), avoiding the double protocol issue while maintaining compatibility with all OAuth providers.
Choose forward.direct when:
- Working with Spotify OAuth or other providers that reject double-protocol URLs
- You prefer cleaner callback URLs without double protocols (e.g.,
domain.com/app.test/callbackvsdomain.com/https://app.test/callback) - You want to self-host your own forwarding infrastructure
- You need custom modifications or additional features
Stick with fwd.host when:
- Working with standard OAuth providers (GitHub, Google, Facebook, etc.) that accept double protocols
- You prefer a hosted solution without deployment overhead
- You want a battle-tested service used by thousands of Laravel developers
- Secure - Only allows redirects to
.testdomains - Fast - Built on Cloudflare Workers edge network
- Flexible - Supports both explicit and implicit protocols
- Simple - No data storage, just redirects
- Open Source - Deploy your own instance
With explicit protocol:
https://forward.direct/https://myapp.test/auth/callback
Without protocol (defaults to HTTP):
https://forward.direct/myapp.test/auth/callback
Instead of setting your OAuth callback URL to:
http://myapp.test/auth/github/callback
Set it to:
https://forward.direct/myapp.test/auth/github/callback
When users complete OAuth authentication, they'll be redirected through your forward.direct service back to your local development site with all the necessary OAuth parameters preserved.
GitHub OAuth App:
- Callback URL:
https://forward.direct/myapp.test/auth/github/callback - Redirects to:
http://myapp.test/auth/github/callback?code=...&state=...
Google OAuth App:
- Callback URL:
https://forward.direct/https://myapp.test/auth/google/callback - Redirects to:
https://myapp.test/auth/google/callback?code=...&state=...
Spotify OAuth App (doesn't support double protocols):
- Callback URL:
https://forward.direct/myapp.test/auth/spotify/callback - Redirects to:
http://myapp.test/auth/spotify/callback?code=...&state=...
- Node.js 18+
- Cloudflare account
- Wrangler CLI
-
Clone the repository:
git clone https://github.com/grey-studio/forward.direct.git forward-direct cd forward-direct -
Install dependencies:
npm install
-
Configure Wrangler:
wrangler login
-
Update configuration: Edit
wrangler.jsoncand change thenamefield to your desired worker name:{ "name": "your-forward-service", "main": "src/index.ts", "compatibility_date": "2025-08-19" } -
Deploy to Cloudflare:
npm run deploy
-
Set up custom domain (optional):
- In Cloudflare Dashboard, go to Workers & Pages
- Click on your worker
- Go to Settings > Triggers
- Add a custom domain
Start local development server:
npm run devRun tests:
npm run testGenerate TypeScript types:
npm run cf-typegenforward.direct only allows redirects to domains ending in .test for security reasons. This prevents the service from
being used as an open redirect for malicious purposes.
Attempting to redirect to any non-.test domain will result in a 403 Forbidden response.
GET /
Redirects to the project's GitHub repository.
Responses:
302 Found- Redirects tohttps://github.com/grey-studio/forward.direct
GET /{targetUrl}
Redirects to the specified target URL if it's a valid .test domain.
Parameters:
targetUrl- The target URL to redirect to, with optional protocol (defaults to HTTP if not specified)
Responses:
302 Found- Successful redirect withLocationheader403 Forbidden- Target URL is not a.testdomain
Examples:
# Root path redirects to GitHub
curl -i https://forward.direct/
# Redirect with explicit protocol
curl -i https://forward.direct/https://app.test/callback
# Redirect with implicit protocol (defaults to HTTP)
curl -i https://forward.direct/app.test/callback
# With query parameters
curl -i "https://forward.direct/app.test/auth/callback?code=123&state=abc"# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverageThis project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by fwd.host by the Laravel Herd team
- Built with Cloudflare Workers
.test domains. Do not use it to redirect to production domains or any domains you don't control.