Skip to content

Commit f476856

Browse files
committed
fix: configure RPC endpoints and CSP for Cloudflare deployment
- Add explicit RPC URLs to wagmi config with publicnode.com fallbacks - Support env vars for custom RPC endpoints (NEXT_PUBLIC_*_RPC_URL) - Add Content-Security-Policy header allowing HTTPS connections - Fix BSC RPC URL in .env.example (was testnet, now mainnet)
1 parent d2516b1 commit f476856

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ NEXT_PUBLIC_KLEVER_API_URL=https://api.mainnet.klever.org
55
# For production, consider using dedicated RPC providers for better reliability
66
NEXT_PUBLIC_ETHEREUM_RPC_URL=https://ethereum-rpc.publicnode.com
77
NEXT_PUBLIC_POLYGON_RPC_URL=https://polygon-bor-rpc.publicnode.com
8-
NEXT_PUBLIC_BSC_RPC_URL=https://bsc-testnet-rpc.publicnode.com
8+
NEXT_PUBLIC_BSC_RPC_URL=https://bsc-rpc.publicnode.com
99
NEXT_PUBLIC_ARBITRUM_RPC_URL=https://arbitrum-one-rpc.publicnode.com

next.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ const nextConfig: NextConfig = {
3434
key: "X-DNS-Prefetch-Control",
3535
value: "on",
3636
},
37+
{
38+
key: "Content-Security-Policy",
39+
value: "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https:; font-src 'self' data:;",
40+
},
3741
],
3842
},
3943
];

src/config/wagmi.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { mainnet, polygon, bsc, arbitrum } from "wagmi/chains";
44
export const config = createConfig({
55
chains: [mainnet, polygon, bsc, arbitrum],
66
transports: {
7-
[mainnet.id]: http(),
8-
[polygon.id]: http(),
9-
[bsc.id]: http(),
10-
[arbitrum.id]: http(),
7+
[mainnet.id]: http(process.env.NEXT_PUBLIC_ETHEREUM_RPC_URL || "https://ethereum-rpc.publicnode.com"),
8+
[polygon.id]: http(process.env.NEXT_PUBLIC_POLYGON_RPC_URL || "https://polygon-bor-rpc.publicnode.com"),
9+
[bsc.id]: http(process.env.NEXT_PUBLIC_BSC_RPC_URL || "https://bsc-rpc.publicnode.com"),
10+
[arbitrum.id]: http(process.env.NEXT_PUBLIC_ARBITRUM_RPC_URL || "https://arbitrum-one-rpc.publicnode.com"),
1111
},
1212
});
1313

0 commit comments

Comments
 (0)