• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Broken JS / CSS Responses by user

Jonatan Grim

New Pleskian
Hello Plesk Forum,

I'm using Plesk 12.5 on CentOS 6.7 with mod_pagespeed (Apache) (Server is up-to-date)
Extensions:
- Let's Encrypt

I have a problem with WordPress Admin.
Frontend CSS / JS is working perfectly.

When accessing /wp-admin, neither CSS or JS is working.

Results of JS:
nHPhj.png


If I try to remove a single parameter from the URL (removing &ver - as example):
3QZin.png


If a new user is accessing /wp-admin, no problems at all
It happens after time.

Can anyone help with this issue?
 
Hi Jonatan Grim,

pls. note, that this forum is a PLESK - related - forum. If you desire help with your Content Management System ( CMS, i.e.: wordpress, joomla, drupal, ... ) at your webspace, pls. consider to open a thread at:

=> Home > Forum > General Discussion > Open Topics

I'm aware that this forum is for Plesk and the reason I'm posting here, is because I was convinced this would be a server problem and not a WordPress problem.
 
Code:
<?php

/**
 * Disable error reporting
 *
 * Set this to error_reporting( -1 ) for debugging
 */
error_reporting(0);

/** Set ABSPATH for execution */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
}

define( 'WPINC', 'wp-includes' );

require( ABSPATH . 'wp-admin/includes/noop.php' );
require( ABSPATH . WPINC . '/script-loader.php' );
require( ABSPATH . WPINC . '/version.php' );

$load = $_GET['load'];
if ( is_array( $load ) ) {
    $load = implode( '', $load );
}
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
$load = array_unique( explode( ',', $load ) );

if ( empty($load) )
    exit;

$compress = ( isset($_GET['c']) && $_GET['c'] );
$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
$expires_offset = 31536000; // 1 year
$out = '';

$wp_styles = new WP_Styles();
wp_default_styles($wp_styles);

/*
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
    $protocol = $_SERVER['SERVER_PROTOCOL'];
    if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
        $protocol = 'HTTP/1.0';
    }
    header( "$protocol 304 Not Modified" );
    exit();
}
*/

foreach ( $load as $handle ) {
    if ( !array_key_exists($handle, $wp_styles->registered) )
        continue;

    $style = $wp_styles->registered[$handle];

    if ( empty( $style->src ) ) {
        continue;
    }

    $path = ABSPATH . $style->src;

    if ( $rtl && ! empty( $style->extra['rtl'] ) ) {
        // All default styles have fully independent RTL files.
        $path = str_replace( '.min.css', '-rtl.min.css', $path );
    }

    $content = get_file( $path ) . "\n";

    if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) {
        $content = str_replace( '../images/', '../' . WPINC . '/images/', $content );
        $content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content );
        $content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content );
        $out .= $content;
    } else {
        $out .= str_replace( '../images/', 'images/', $content );
    }
}


// header("Etag: $wp_version");
header('Content-Type: text/css; charset=UTF-8');
// header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
// header("Cache-Control: public, max-age=$expires_offset");

/*
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
    header('Vary: Accept-Encoding'); // Handle proxies
    if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
        header('Content-Encoding: deflate');
        $out = gzdeflate( $out, 3 );
    } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
        header('Content-Encoding: gzip');
        $out = gzencode( $out, 3 );
    }
} */

echo $out;
exit;

I have "solved" the problem by commenting much of the above code in load-styles.php
Since this works I'm positive that this is a server problem - a Plesk problem.

Anyone having any ideas?
 
Back
Top