Opened 14 years ago
Closed 12 years ago
#17669 closed defect (bug) (duplicate)
URL is incorrect when trying to post media/image/audio/video
Reported by: | AllyUnion | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1.3 |
Component: | HTTP API | Keywords: | |
Focuses: | Cc: |
Description
Server 1 is running http://www.example.com
Server 2 is running blog.example.com (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 http://blog.example.com
ProxyPassReverse /blog http://blog.example.com
In our Word Press site configuration under Settings > General
We defined
WordPress address (URL) as "http://www.example.com/blog" and
Site address (URL) as "http://www.example.com/blog"
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:
"/wp-admin/media-upload.php?post_id=207&type=image&tab=type"
Which is not correct. It should be:
"http://www.example.com/blog/wp-admin/media-upload.php?post_id=207&type=image&tab=type"
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
@
14 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
@
14 years ago
Also line 634:
from:
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVERHTTP_HOST? . $_SERVERREQUEST_URI?;
to:
$current_url = get_bloginfo('url') . $_SERVERREQUEST_URI?;
#5
@
14 years ago
New paste: http://pastebin.com/66hv36WC
#6
@
14 years ago
Patch file:
http://pastebin.com/6mX1jx8s
Based on this paste:
http://pastebin.com/wHttk8UT
#7
@
14 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
@
12 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' );
Updated paste:
http://pastebin.com/yVRsS2CA