Skip to content

v9.2.9

Choose a tag to compare

@github-actions github-actions released this 07 Aug 14:52
2a8e696

v9.2.9

🚨 BREAKING CHANGE: Improved IP Handling in Next.js Middleware

Summary

This PR enhances the IP handling capabilities in the Frontegg Next.js middleware by adding support for custom IP resolver functions and improving the priority order for IP resolution.

⚠️ API Method Renamed:

FronteggApiMiddleware.cors() has been renamed to FronteggApiMiddleware.withOptions()
This change affects any existing implementations using the CORS functionality

Migration Required:

// Before (❌ Will break)
export default FronteggApiMiddleware.cors({
  allowedOrigins: ['http://localhost:3000'],
  allowCredentials: true,
});

// After (✅ New syntax)
export default FronteggApiMiddleware.withOptions({
  cors: {
    allowedOrigins: ['http://localhost:3000'],
    allowCredentials: true,
  }
});

New Feature

Added ipResolver parameter to FronteggApiMiddleware.withOptions()
Allows developers to provide custom logic for extracting client IP addresses
Useful for environments with custom proxy setups or non-standard IP headers
Example Usage:

export default FronteggApiMiddleware.withOptions({
  ipResolver: (req) => req.headers['x-your-custom-ip-header']?.toString(),
});