Spaces:
Running
Running
Download wp-config.php from OptiMix51/optimix-blog: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/spaces/OptiMix51/optimix-blog/resolve/main/wp-config.php
- Command line
-
hf download hf://spaces/OptiMix51/optimix-blog/wp-config.php
-
curl -L -o wp-config.php https://huggingface.co/spaces/OptiMix51/optimix-blog/resolve/main/wp-config.php
2.73 kB
| /** | |
| * Custom wp-config.php for Hugging Face Spaces + Vercel Proxy + Aiven MySQL | |
| */ | |
| // --- PROXY AWARENESS --- | |
| $is_branded_proxy = false; | |
| if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { | |
| $_SERVER['HTTPS'] = 'on'; | |
| } | |
| $forwarded_host = $_SERVER['HTTP_X_FORWARDED_HOST'] ?? ''; | |
| // Only treat as proxy if it's NOT a direct HF link | |
| if ($forwarded_host && strpos($forwarded_host, 'hf.space') === false) { | |
| $is_branded_proxy = true; | |
| $_SERVER['HTTP_HOST'] = $forwarded_host; | |
| // Fix REQUEST_URI for WordPress when behind Vercel rewrite | |
| if (strpos($_SERVER['REQUEST_URI'], '/blog') !== 0) { | |
| $_SERVER['REQUEST_URI'] = '/blog' . $_SERVER['REQUEST_URI']; | |
| } | |
| // Fix SCRIPT_NAME and PHP_SELF for subpath proxying | |
| $_SERVER['SCRIPT_NAME'] = '/blog' . $_SERVER['SCRIPT_NAME']; | |
| $_SERVER['PHP_SELF'] = '/blog' . $_SERVER['PHP_SELF']; | |
| } | |
| // Ensure WordPress knows its public URL | |
| if ($is_branded_proxy) { | |
| // Branded view through Vercel | |
| define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/blog'); | |
| // Bypass Vercel WAF for wp-admin by pointing SITEURL directly to Hugging Face | |
| define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/blog'); | |
| define('ADMIN_COOKIE_PATH', '/'); | |
| define('COOKIEPATH', '/blog/'); | |
| define('SITECOOKIEPATH', '/blog/'); | |
| } else { | |
| // Direct view on Hugging Face (or other non-branded domains) | |
| define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']); | |
| define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']); | |
| } | |
| define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST'] ?? ''); | |
| // --- AIVEN MYSQL CONFIGURATION --- | |
| define('DB_NAME', 'defaultdb'); | |
| define('DB_USER', 'avnadmin'); | |
| define('DB_PASSWORD', 'AVNS_5wu7NICxxCSSiTuBqcP'); | |
| define('DB_HOST', 'aureliansystems-eyuan151-c338.b.aivencloud.com:24495'); | |
| define('DB_CHARSET', 'utf8'); | |
| define('DB_COLLATE', ''); | |
| // Required for Aiven MySQL | |
| define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL); | |
| // --- AUTH KEYS (GENERATED) --- | |
| define('AUTH_KEY', 'put your unique phrase here'); | |
| define('SECURE_AUTH_KEY', 'put your unique phrase here'); | |
| define('LOGGED_IN_KEY', 'put your unique phrase here'); | |
| define('NONCE_KEY', 'put your unique phrase here'); | |
| define('AUTH_SALT', 'put your unique phrase here'); | |
| define('SECURE_AUTH_SALT', 'put your unique phrase here'); | |
| define('LOGGED_IN_SALT', 'put your unique phrase here'); | |
| define('NONCE_SALT', 'put your unique phrase here'); | |
| $table_prefix = 'wp_'; | |
| define('WP_DEBUG', false); | |
| // Force clean permalinks for SEO behind proxy | |
| define('GOT_REWRITE', true); | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| define( 'ABSPATH', __DIR__ . '/' ); | |
| } | |
| require_once ABSPATH . 'wp-settings.php'; | |