diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
index dc0c8f8..adc3840 100644
--- src/wp-includes/default-filters.php
+++ src/wp-includes/default-filters.php
@@ -134,6 +134,7 @@ add_filter( 'the_content', 'convert_chars'      );
 add_filter( 'the_content', 'wpautop'            );
 add_filter( 'the_content', 'shortcode_unautop'  );
 add_filter( 'the_content', 'prepend_attachment' );
+add_filter( 'the_content', 'wp_filter_uploads_scheme' );
 
 add_filter( 'the_excerpt',     'wptexturize'      );
 add_filter( 'the_excerpt',     'convert_smilies'  );
diff --git src/wp-includes/formatting.php src/wp-includes/formatting.php
index 411eaa8..9fd13dc 100644
--- src/wp-includes/formatting.php
+++ src/wp-includes/formatting.php
@@ -3995,3 +3995,30 @@ function wp_spaces_regexp() {
 
 	return $spaces;
 }
+
+/**
+ * Returns scheme relative URLs for local URLs contained in a string of text. 
+ * Created to be a display_filter for $content, but could have other uses.
+ *
+ * @param string $content A string which might contain a URL.
+ * @return string The found URL.
+ */
+function wp_filter_uploads_scheme( $content ) {
+	if ( empty( $content ) ) {
+		return false;
+	}
+	
+	// get upload directory and set baseurl
+	$upload_dir = wp_upload_dir();
+	$upload_url = $upload_dir['baseurl'];
+
+	// set relative URL scheme for the upload directory
+	$rel_upload_url = set_url_scheme( $upload_dir['baseurl'] );
+
+	// split the upload URL because both schemes might be found in the content
+	list( $scheme, $url) = explode( ':', $upload_url, 2 );
+	
+	$content = preg_replace( "|https?:" . $url ."|", $rel_upload_url, $content );
+
+	return $content;
+}
\ No newline at end of file
diff --git src/wp-includes/post.php src/wp-includes/post.php
index 81cd12a..5f08625 100644
--- src/wp-includes/post.php
+++ src/wp-includes/post.php
@@ -4946,6 +4946,9 @@ function wp_get_attachment_url( $post_id = 0 ) {
 		$url = get_the_guid( $post->ID );
 	}
 
+	// Match the current scheme.
+	$url = set_url_scheme( $url );
+
 	/**
 	 * Filter the attachment URL.
 	 *
diff --git tests/phpunit/tests/post/attachments.php tests/phpunit/tests/post/attachments.php
index d079654..7c4fb06 100644
--- tests/phpunit/tests/post/attachments.php
+++ tests/phpunit/tests/post/attachments.php
@@ -278,4 +278,53 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
 		$this->assertEquals( $attachment->post_parent, $post_id );
 	}
 
+	/**
+	 * @ticket 15928
+	 */
+	public function test_wp_get_attachment_with_https_off() {
+		$filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
+		$contents = file_get_contents( $filename );
+
+		$upload = wp_upload_bits( basename( $filename ), null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		// Set attachment ID
+		$attachment_id = $this->_make_attachment( $upload );
+
+		$is_ssl = is_ssl();
+		$_SERVER['HTTPS'] = 'off';
+
+		// Test that wp_get_attachemt_url returns with http scheme
+		$url = wp_get_attachment_url( $attachment_id );
+		$this->assertSame( $url, set_url_scheme( $url, 'http' ) );
+
+		// Cleanup
+		$_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
+	}
+
+	/**
+	 * @ticket 15928
+	 */
+	public function test_wp_get_attachment_url_with_https_on() {
+		$filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
+		$contents = file_get_contents( $filename );
+
+		$upload = wp_upload_bits( basename( $filename ), null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		// Set attachment ID
+		$attachment_id = $this->_make_attachment( $upload );
+
+		$is_ssl = is_ssl();
+		$_SERVER['HTTPS'] = 'on';
+
+		// Test that wp_get_attachemt_url returns with https scheme
+		$url = wp_get_attachment_url( $attachment_id );
+		$this->assertSame( $url, set_url_scheme( $url, 'https' ) );
+
+		// Cleanup
+		$_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
+	}
+
 }
+
