Make WordPress Core

Opened 12 years ago

Closed 10 years ago

#17669 closed defect (bug) (duplicate)

URL is incorrect when trying to post media/image/audio/video

Reported by: allyunion's profile AllyUnion Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1.3
Component: HTTP API Keywords:
Focuses: Cc:


Server 1 is running
Server 2 is running (Word Press site)

Server 1 is on our corporate infrastructure
Server 2 is within the Amazon EC2 cloud.

We generated ProxyPass rules using Apache to implement:

ProxyPass /blog
ProxyPassReverse /blog

In our Word Press site configuration under Settings > General

We defined
WordPress address (URL) as "" and
Site address (URL) as ""

Any time we try to use Post > Add New Post then click on:

Add an Image / Add Video / Add Audio / Add Media

The sub-popup window links at the top for:
From Computer
From URL
Media Library

Are not linked properly. The links we have for them are something like:

Which is not correct. It should be:

If the siteurl is defined, then add_query_arg should rely on get_option('siteurl') to get the proper URL.

I believe this is the fix but I am not familiar with the Word Press code enough to say this is the proper fix:

Change History (9)

#2 @AllyUnion
12 years ago

Along with this file, class-wp-list-table.php needs to be modified on line 478 with:
$current_url = get_bloginfo('url') . $_SERVERREQUEST_URI?;

#3 @AllyUnion
12 years ago

Also line 634:
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVERHTTP_HOST? . $_SERVERREQUEST_URI?;

$current_url = get_bloginfo('url') . $_SERVERREQUEST_URI?;

#4 @AllyUnion
12 years ago

Scratch the last two comments

#7 @nacin
12 years ago

Patches need to be uploaded here, and they cannot be simple unified diffs, you need to use SVN's diff tool.

I don't think this is a bug here. Your server isn't fully configured. If you're going to mess with proxies, then you also need to ensure that REQUEST_URI is repaired.

#8 @merty
10 years ago

  • Component changed from Post Types to HTTP

Even though I actually agree with @nacin, I also think that we need to consider situations where it may not be possible to make necessary changes in the server configuration. I recently came across the same problem on a client's project where I had a limited time to fix and had no access to the server that needs a modification in its configuration. Since prepending the site URL would do no harm to WordPress and actually solve people's problems, I think it should be implemented.

I had to solve this problem quickly, so I put the following to the mu-plugins directory:

function merty_fix_redirect_location( $location ) {	

	if ( '/' == $location[0] )
		$location = site_url() . $location;

	return $location;

add_filter( 'wp_redirect', 'merty_fix_redirect_location' );

#9 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.