Don't remove www from hostname.
This commit is contained in:
@@ -10,12 +10,6 @@ import { secret, uuid, visitSalt } from '@/lib/crypto';
|
||||
import { COLLECTION_TYPE } from '@/lib/constants';
|
||||
import { createSession, saveEvent, saveSessionData } from '@/queries';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
// Bot check
|
||||
if (!process.env.DISABLE_BOT_CHECK && isbot(request.headers.get('user-agent'))) {
|
||||
return json({ beep: 'boop' });
|
||||
}
|
||||
|
||||
const schema = z.object({
|
||||
type: z.enum(['event', 'identify']),
|
||||
payload: z.object({
|
||||
@@ -34,6 +28,12 @@ export async function POST(request: Request) {
|
||||
}),
|
||||
});
|
||||
|
||||
export async function POST(request: Request) {
|
||||
// Bot check
|
||||
if (!process.env.DISABLE_BOT_CHECK && isbot(request.headers.get('user-agent'))) {
|
||||
return json({ beep: 'boop' });
|
||||
}
|
||||
|
||||
const { body, error } = await parseRequest(request, schema, { skipAuth: true });
|
||||
|
||||
if (error) {
|
||||
@@ -133,7 +133,7 @@ export async function POST(request: Request) {
|
||||
|
||||
let urlPath = currentUrl.pathname;
|
||||
const urlQuery = currentUrl.search.substring(1);
|
||||
const urlDomain = currentUrl.hostname.replace(/^www\./, '');
|
||||
const urlDomain = currentUrl.hostname;
|
||||
|
||||
if (process.env.REMOVE_TRAILING_SLASH) {
|
||||
urlPath = urlPath.replace(/(.+)\/$/, '$1');
|
||||
@@ -150,7 +150,7 @@ export async function POST(request: Request) {
|
||||
referrerQuery = referrerUrl.search.substring(1);
|
||||
|
||||
if (referrerUrl.hostname !== 'localhost') {
|
||||
referrerDomain = referrerUrl.hostname.replace(/^www\./, '');
|
||||
referrerDomain = referrerUrl.hostname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user