Index: /CKEditor/branches/versions/3.1.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4664)
+++ /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4665)
@@ -110,4 +110,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4450">#4450</a> : Fixed selecting multiple table cells before apply justify commands generates spurious paragraph in Firefox.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4733">#4733</a> : Fixed dialog opening sometimes hang up Firefox and Safari.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3401">#3401</a> : Fixed baseHref config not working with image/flash dialog preview area.</li>
 	</ul>
 	<h3>
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/flash/dialogs/flash.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/flash/dialogs/flash.js	(revision 4664)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/flash/dialogs/flash.js	(revision 4665)
@@ -174,5 +174,6 @@
 			makeEmbedTag = editor.config.flashAddEmbedTag || editor.config.flashEmbedTagOnly;
 
-		var previewAreaHtml = '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.image.preview ) +'<br>' +
+		var previewPreloader,
+			previewAreaHtml = '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.image.preview ) +'<br>' +
 			'<div id="FlashPreviewLoader" style="display:none"><div class="loading">&nbsp;</div></div>' +
 			'<div id="FlashPreviewBox"></div></div>';
@@ -186,4 +187,5 @@
 				// Clear previously saved elements.
 				this.fakeImage = this.objectNode = this.embedNode = null;
+				previewPreloader = new CKEDITOR.dom.element( 'embeded', editor.document );
 
 				// Try to detect any embed or object tag that has Flash parameters.
@@ -319,7 +321,8 @@
 												var dialog = this.getDialog(),
 												updatePreview = function( src ){
-
+													// Query the preloader to figure out the url impacted by based href.
+													previewPreloader.setAttribute( 'src', src );
 													dialog.preview.setHtml( '<embed height="100%" width="100%" src="'
-														+ CKEDITOR.tools.htmlEncode( src )
+														+ CKEDITOR.tools.htmlEncode( previewPreloader.getAttribute( 'src' ) )
 														+ '" type="application/x-shockwave-flash"></embed>' );
 												};
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/image/dialogs/image.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/image/dialogs/image.js	(revision 4664)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/image/dialogs/image.js	(revision 4665)
@@ -146,4 +146,6 @@
 	var imageDialog = function( editor, dialogType )
 	{
+		var previewPreloader;
+
 		var onImgLoadEvent = function()
 		{
@@ -260,4 +262,5 @@
 				}
 
+				previewPreloader = new CKEDITOR.dom.element( 'img', editor.document );
 				// Dont show preview if no URL given.
 				if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) )
@@ -423,6 +426,8 @@
 													original.on( 'abort', onImgLoadErrorEvent, dialog );
 													original.setAttribute( 'src', newUrl );
-													dialog.preview.setAttribute( 'src', newUrl );
-
+
+													// Query the preloader to figure out the url impacted by based href.
+													previewPreloader.setAttribute( 'src', newUrl );
+													dialog.preview.setAttribute( 'src', previewPreloader.$.src );
 													updatePreview( dialog );
 												}
