Hostinger's hosting environment appears to strip the Authorization header from outgoing wp_remote_post requests before they reach the cURL transport. This caused OpenRouter to respond with HTTP 401 "Missing Authentication header" even though the header was set in the wp_remote_post args array. Fixes: - Add http_api_curl filter (priority 99) that re-sets the Authorization header directly on the cURL handle, bypassing any intermediate header stripping. Scoped to openrouter.ai URLs only. - Applied to all three OpenRouter call sites: send_chat_completion, validate_credentials_detailed, and get_available_models. - Filter is cleaned up in a finally block to avoid leaking. Also: - Add pre-flight key format validation (must start with "sk-or-") to catch corrupted decryption early with a clear error message. - Fix retry condition: was `>= 429` (incorrectly retried 430-499), now `=== 429` (only retry rate-limit). - Add detailed diagnostic logging on 401/403 auth failures. - Add .env.credentials to .gitignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
298 B
Plaintext
Executable File
29 lines
298 B
Plaintext
Executable File
# Dependencies
|
|
vendor/
|
|
node_modules/
|
|
|
|
# Build artifacts
|
|
build/
|
|
*.zip
|
|
|
|
# IDE / OS
|
|
.idea/
|
|
.vscode/
|
|
.DS_Store
|
|
Thumbs.db
|
|
*.swp
|
|
*.swo
|
|
|
|
# Environment & credentials
|
|
.env
|
|
.env.local
|
|
.env.credentials
|
|
|
|
# Logs
|
|
*.log
|
|
debug.log
|
|
|
|
# WordPress (if developing inside a WP install)
|
|
wp-config.php
|
|
wp-content/uploads/
|