diff --git a/libs/configuration.js b/libs/configuration.js
index 95b11e3a5b297711cebbb965fffe3f9ca85bd564..54a24237863368ff86def66c6ba16b3af114a756 100644
--- a/libs/configuration.js
+++ b/libs/configuration.js
@@ -154,13 +154,13 @@ g_config['URL'] = g_config['scheme'] + '://' + g_config['hostname'] + getPortFor
  * to re-write urls as needed for this particular environment.
  *
  * Note, for a 'local' environment, no re-write is needed because this is
- * handled at a higher level.  For a 'production' env no rewrite is necc cause
- * all source files are written for that environment.
+ * handled at a higher level.  For other environments, only perform re-writing
+ * if the host, port, or scheme are different than https://browserid.org:443
+ * (all source files always should have the production hostname written into them)
  */
 exports.performSubstitution = function(app) {
-  if (g_config.hostname != 'browserid.org' ||
-      g_config.port != '443' ||
-      g_config.scheme != 'https') {
+  if ((g_config.hostname != 'browserid.org' || g_config.port != '443' || g_config.scheme != 'https') &&
+      process.env['NODE_ENV'] !== 'local'){
     app.use(substitution.substitute({
       'https://browserid.org': g_config['URL'],
       'browserid.org:443': g_config['hostname'] + ':' + g_config['port'],
@@ -171,7 +171,7 @@ exports.performSubstitution = function(app) {
 
 // At the time this file is required, we'll determine the "process name" for this proc
 // if we can determine what type of process it is (browserid or verifier) based
-// on the path, we'll use that, otherwise we'll name it 'ephemeral'.  
+// on the path, we'll use that, otherwise we'll name it 'ephemeral'.
 if (process.argv[1] == path.join(__dirname, "..", "browserid", "run.js")) {
   g_config['process_type'] = 'browserid';
 } else if (process.argv[1] == path.join(__dirname, "..", "verifier", "run.js")) {