
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can see the issue! When you specify scheme: ["https"] in your URI validation, it conflicts with allowRelative: true. The scheme option tells Sanity to only accept URLs with the https protocol, which means relative URLs like "/home" or "/contact" will fail validation because they don't have a scheme at all.
Here's the fix - you need to remove the scheme option when you want to allow relative URLs:
validation: (Rule) =>
Rule.required().uri({
allowRelative: true, // Allow relative links
relativeOnly: false, // Allow both relative AND absolute links
// Don't specify scheme when allowing relative URLs
}),If you want to only accept relative URLs (like "/home", "/contact"), use:
validation: (Rule) =>
Rule.required().uri({
relativeOnly: true, // Only relative links allowed
}),If you want to accept either relative URLs or only HTTPS absolute URLs (but not HTTP), you'll need a custom validation function:
validation: (Rule) =>
Rule.required().custom((value) => {
if (!value) return true;
// Allow relative URLs
if (value.startsWith('/')) return true;
// For absolute URLs, only allow HTTPS
if (value.startsWith('https://')) return true;
return 'Please use a relative URL (like /home) or an HTTPS URL';
}),The key takeaway: the scheme option in Rule.uri() is specifically for validating the protocol of absolute URLs. When you want to allow relative URLs, either omit the scheme option entirely or use custom validation logic if you need more complex rules combining relative paths with specific scheme requirements.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store