Cloudflare Integration - GrackerAI Portal
This comprehensive guide covers Cloudflare integration scenarios for GrackerAI's cybersecurity content marketing platform, including subpath routing and custom domain configuration.
Subpath Routing with Cloudflare Workers
Host your GrackerAI portal at a custom subpath (e.g., /portal
, /dashboard
) on your domain using Cloudflare Workers for seamless integration.
Step 1: Create a Cloudflare Worker
If you haven't already, create a Cloudflare Worker by following the Cloudflare Workers getting started guide (opens in a new tab).
Step 2: Configure Worker Code
- Log in to the Cloudflare dashboard and select your account
- Navigate to Workers & Pages
- Select your Worker application
- Click Edit Code
Replace the default Worker code with the following script. For detailed information on editing Workers, refer to the Cloudflare Workers documentation (opens in a new tab).
Replace /yoursubpath
with your desired subpath (e.g., /portal
, /dashboard
, /app
). This will be the URL path where your GrackerAI portal will be accessible on your domain.
const seoTargetBase = 'https://portal.pseo.one';
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
const origin = url.origin;
const pathname = url.pathname;
if (pathname.startsWith("/yoursubpath")) {
const targetUrl = seoTargetBase + url.pathname + url.search;
const newHeaders = new Headers(request.headers);
newHeaders.set('x-req-domain', origin);
const newRequest = new Request(targetUrl, {
method: request.method,
headers: newHeaders,
body: request.body,
redirect: 'manual'
});
const response = await fetch(newRequest);
return new Response(response.body, response);
}
return fetch(request);
}
};
Click Deploy to save your changes. Deployment typically takes a few minutes, but full propagation can take up to several hours.
Step 3: Test Your Worker
Once deployed, verify that your Worker correctly routes requests to your GrackerAI portal.
-
Test using the Worker's preview URL:
your-worker.your-subdomain.workers.dev/yoursubpath
Note: The preview URL will display a default page for verification purposes, not your actual GrackerAI portal interface.
Step 4: Configure Worker Routes
Connect your Worker to your domain by configuring a route pattern that defines when the Worker should handle requests.
-
In your Worker settings, navigate to the Domains & Routes tab
-
Click Add Route
-
Enter your route pattern:
yourdomain.com/yoursubpath*
-
Select your zone from the dropdown menu
-
Click Save
Important: Ensure your domain's DNS entry is proxied (indicated by the orange cloud icon). If it shows a grey cloud, click it to enable proxying. This is required for traffic to route through your Cloudflare Worker.
Route Pattern Examples
example.com/portal/*
- Routes all requests starting with/portal/
*.example.com/docs/*
- Routes subdomains with/docs/
path
For comprehensive information on route patterns and advanced configuration options, refer to the Cloudflare Workers Routes documentation (opens in a new tab).
Custom Domain Setup with Cloudflare
This section provides a comprehensive guide for configuring custom domains using Cloudflare's DNS management for seamless GrackerAI portal integration.
Step 1: Configure DNS Records
Connect your custom domain to the GrackerAI portal by adding a CNAME record in your Cloudflare DNS settings.
Add CNAME Record
- Log in to your Cloudflare dashboard
- Navigate to DNS > Records
- Click Add record
- Configure the CNAME record with the following settings:
Type: CNAME
Name: your-subdomain (e.g., portal, portal-101)
Target: portal.pseo.one
Proxy status: Proxied (orange cloud)
Configuration Example
portal-101.customer1.com → portal.pseo.one
Step 2: Verify DNS Propagation
After adding the CNAME record, monitor the propagation status:
- Cloudflare Proxy: Changes typically propagate within 2-5 minutes
- Global Propagation: Full worldwide propagation may take 24-48 hours
- Verification Tool: Use DNS Checker (opens in a new tab) to monitor propagation status
Pro Tip: Enable Cloudflare's proxy (orange cloud) for enhanced security, performance optimization, and faster propagation times.
Additional Resources
For more detailed information on Cloudflare DNS management: