Просмотр исходного кода

Merge pull request #18116 from overleaf/jpa-bulk-replace-localhost

[misc] bulk replace localhost with 127.0.0.1

GitOrigin-RevId: d238f3635302e8ff5500d611108c4d1bef216726
Jakob Ackermann 2 лет назад
Родитель
Сommit
a540754f6e
74 измененных файлов с 236 добавлено и 236 удалено
  1. 1 1
      libraries/fetch-utils/test/unit/FetchUtilsTests.js
  2. 1 1
      libraries/redis-wrapper/test/scripts/standalone.js
  3. 3 3
      services/chat/config/settings.defaults.cjs
  4. 1 1
      services/chat/test/acceptance/js/helpers/ChatApp.js
  5. 1 1
      services/chat/test/acceptance/js/helpers/ChatClient.js
  6. 3 3
      services/clsi/config/settings.defaults.js
  7. 1 1
      services/clsi/test/acceptance/js/helpers/Client.js
  8. 2 2
      services/contacts/config/settings.defaults.cjs
  9. 2 2
      services/contacts/test/acceptance/js/GettingContactsTests.js
  10. 1 1
      services/docstore/app/js/HealthChecker.js
  11. 1 1
      services/docstore/config/settings.defaults.js
  12. 1 1
      services/docstore/test/acceptance/js/helpers/DocstoreApp.js
  13. 11 11
      services/docstore/test/acceptance/js/helpers/DocstoreClient.js
  14. 1 1
      services/document-updater/app.js
  15. 8 8
      services/document-updater/config/settings.defaults.js
  16. 1 1
      services/document-updater/test/acceptance/js/helpers/DocUpdaterApp.js
  17. 15 15
      services/document-updater/test/acceptance/js/helpers/DocUpdaterClient.js
  18. 2 2
      services/document-updater/test/cluster_failover/js/test_blpop_failover.js
  19. 2 2
      services/document-updater/test/cluster_failover/js/test_pubsub_failover.js
  20. 1 1
      services/filestore/config/settings.defaults.js
  21. 1 1
      services/filestore/test/acceptance/deps/Dockerfile.fake-gcs
  22. 1 1
      services/filestore/test/acceptance/deps/Dockerfile.s3mock
  23. 1 1
      services/filestore/test/acceptance/js/FilestoreApp.js
  24. 1 1
      services/filestore/test/acceptance/js/FilestoreTests.js
  25. 1 1
      services/history-v1/test/acceptance/js/api/support/test_server.js
  26. 1 1
      services/notifications/app.js
  27. 1 1
      services/notifications/app/js/HealthCheckController.js
  28. 2 2
      services/notifications/config/settings.defaults.js
  29. 2 2
      services/project-history/app/js/HealthChecker.js
  30. 9 9
      services/project-history/config/settings.defaults.cjs
  31. 2 2
      services/project-history/test/acceptance/js/DeleteProjectTests.js
  32. 3 3
      services/project-history/test/acceptance/js/DiffTests.js
  33. 2 2
      services/project-history/test/acceptance/js/DiscardingUpdatesTests.js
  34. 3 3
      services/project-history/test/acceptance/js/FileTreeDiffTests.js
  35. 6 6
      services/project-history/test/acceptance/js/FlushManagerTests.js
  36. 3 3
      services/project-history/test/acceptance/js/HealthCheckTests.js
  37. 3 3
      services/project-history/test/acceptance/js/LabelsTests.js
  38. 2 2
      services/project-history/test/acceptance/js/ReadingASnapshotTests.js
  39. 6 6
      services/project-history/test/acceptance/js/RetryTests.js
  40. 4 4
      services/project-history/test/acceptance/js/SendingUpdatesTests.js
  41. 3 3
      services/project-history/test/acceptance/js/SummarisedUpdatesTests.js
  42. 5 5
      services/project-history/test/acceptance/js/SyncTests.js
  43. 1 1
      services/project-history/test/acceptance/js/helpers/ProjectHistoryApp.js
  44. 15 15
      services/project-history/test/acceptance/js/helpers/ProjectHistoryClient.js
  45. 7 7
      services/real-time/config/settings.defaults.js
  46. 1 1
      services/real-time/test/acceptance/js/DrainManagerTests.js
  47. 1 1
      services/real-time/test/acceptance/js/HttpControllerTests.js
  48. 4 4
      services/real-time/test/acceptance/js/helpers/RealTimeClient.js
  49. 1 1
      services/real-time/test/acceptance/js/helpers/RealtimeServer.js
  50. 3 3
      services/real-time/test/acceptance/libs/XMLHttpRequest.js
  51. 1 1
      services/spelling/app.js
  52. 1 1
      services/spelling/app/js/HealthCheckController.js
  53. 1 1
      services/spelling/config/settings.defaults.cjs
  54. 1 1
      services/spelling/test/acceptance/js/Init.js
  55. 1 1
      services/spelling/test/acceptance/js/helpers/request.js
  56. 1 1
      services/spelling/test/stress/js/stressTest.js
  57. 1 1
      services/web/app.js
  58. 35 35
      services/web/config/settings.defaults.js
  59. 2 2
      services/web/docker-compose.common.env
  60. 2 2
      services/web/local-test.env
  61. 1 1
      services/web/modules/server-ce-scripts/test/acceptance/src/ServerCEScriptsTests.js
  62. 17 17
      services/web/test/acceptance/config/settings.test.defaults.js
  63. 5 5
      services/web/test/acceptance/config/settings.test.saas.js
  64. 1 1
      services/web/test/acceptance/src/HttpPermissionsPolicyTests.js
  65. 1 1
      services/web/test/acceptance/src/LinkedFilesTests.js
  66. 1 1
      services/web/test/acceptance/src/helpers/UserHelper.js
  67. 1 1
      services/web/test/acceptance/src/helpers/request.js
  68. 1 1
      services/web/test/acceptance/src/mocks/MockV1HistoryApi.js
  69. 1 1
      services/web/test/frontend/bootstrap.js
  70. 1 1
      services/web/test/unit/src/Compile/CompileManagerTests.js
  71. 3 3
      services/web/test/unit/src/Exports/ExportsHandlerTests.js
  72. 1 1
      services/web/test/unit/src/HelperFiles/UrlHelperTests.js
  73. 1 1
      services/web/test/unit/src/Templates/TemplatesManagerTests.js
  74. 1 1
      services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js

+ 1 - 1
libraries/fetch-utils/test/unit/FetchUtilsTests.js

@@ -18,7 +18,7 @@ describe('fetch-utils', function () {
   before(async function () {
   before(async function () {
     this.server = new TestServer()
     this.server = new TestServer()
     await this.server.start(PORT)
     await this.server.start(PORT)
-    this.url = path => `http://localhost:${PORT}${path}`
+    this.url = path => `http://127.0.0.1:${PORT}${path}`
   })
   })
 
 
   after(async function () {
   after(async function () {

+ 1 - 1
libraries/redis-wrapper/test/scripts/standalone.js

@@ -4,7 +4,7 @@
 const redis = require('../../')
 const redis = require('../../')
 const logger = require('@overleaf/logger')
 const logger = require('@overleaf/logger')
 
 
-const rclient = redis.createClient({ host: 'localhost', port: '6379' })
+const rclient = redis.createClient({ host: '127.0.0.1', port: '6379' })
 
 
 setInterval(() => {
 setInterval(() => {
   rclient.healthCheck(err => {
   rclient.healthCheck(err => {

+ 3 - 3
services/chat/config/settings.defaults.cjs

@@ -1,14 +1,14 @@
 module.exports = {
 module.exports = {
   internal: {
   internal: {
     chat: {
     chat: {
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
       port: 3010,
       port: 3010,
     },
     },
   },
   },
 
 
   apis: {
   apis: {
     web: {
     web: {
-      url: `http://${process.env.WEB_HOST || 'localhost'}:${
+      url: `http://${process.env.WEB_HOST || '127.0.0.1'}:${
         process.env.WEB_PORT || 3000
         process.env.WEB_PORT || 3000
       }`,
       }`,
       user: process.env.WEB_API_USER || 'overleaf',
       user: process.env.WEB_API_USER || 'overleaf',
@@ -19,7 +19,7 @@ module.exports = {
   mongo: {
   mongo: {
     url:
     url:
       process.env.MONGO_CONNECTION_STRING ||
       process.env.MONGO_CONNECTION_STRING ||
-      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
+      `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
     options: {
     options: {
       monitorCommands: true,
       monitorCommands: true,
     },
     },

+ 1 - 1
services/chat/test/acceptance/js/helpers/ChatApp.js

@@ -9,7 +9,7 @@ export async function ensureRunning() {
   if (!serverPromise) {
   if (!serverPromise) {
     const { app } = await createServer()
     const { app } = await createServer()
     const startServer = promisify(app.listen.bind(app))
     const startServer = promisify(app.listen.bind(app))
-    serverPromise = startServer(3010, 'localhost')
+    serverPromise = startServer(3010, '127.0.0.1')
   }
   }
   return serverPromise
   return serverPromise
 }
 }

+ 1 - 1
services/chat/test/acceptance/js/helpers/ChatClient.js

@@ -1,7 +1,7 @@
 import Request from 'request'
 import Request from 'request'
 
 
 const request = Request.defaults({
 const request = Request.defaults({
-  baseUrl: 'http://localhost:3010',
+  baseUrl: 'http://127.0.0.1:3010',
 })
 })
 
 
 async function asyncRequest(options) {
 async function asyncRequest(options) {

+ 3 - 3
services/clsi/config/settings.defaults.js

@@ -23,7 +23,7 @@ module.exports = {
   internal: {
   internal: {
     clsi: {
     clsi: {
       port: 3013,
       port: 3013,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
 
 
     load_balancer_agent: {
     load_balancer_agent: {
@@ -35,12 +35,12 @@ module.exports = {
   apis: {
   apis: {
     clsi: {
     clsi: {
       // Internal requests (used by tests only at the time of writing).
       // Internal requests (used by tests only at the time of writing).
-      url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
+      url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:3013`,
       // External url prefix for output files, e.g. for requests via load-balancers.
       // External url prefix for output files, e.g. for requests via load-balancers.
       outputUrlPrefix: `${process.env.ZONE ? `/zone/${process.env.ZONE}` : ''}`,
       outputUrlPrefix: `${process.env.ZONE ? `/zone/${process.env.ZONE}` : ''}`,
     },
     },
     clsiPerf: {
     clsiPerf: {
-      host: `${process.env.CLSI_PERF_HOST || 'localhost'}:${
+      host: `${process.env.CLSI_PERF_HOST || '127.0.0.1'}:${
         process.env.CLSI_PERF_PORT || '3043'
         process.env.CLSI_PERF_PORT || '3043'
       }`,
       }`,
     },
     },

+ 1 - 1
services/clsi/test/acceptance/js/helpers/Client.js

@@ -72,7 +72,7 @@ module.exports = Client = {
           done(new Error('error starting server: ' + error.message))
           done(new Error('error starting server: ' + error.message))
         } else {
         } else {
           const addr = server.address()
           const addr = server.address()
-          Settings.filestoreDomainOveride = `http://localhost:${addr.port}`
+          Settings.filestoreDomainOveride = `http://127.0.0.1:${addr.port}`
           done()
           done()
         }
         }
       })
       })

+ 2 - 2
services/contacts/config/settings.defaults.cjs

@@ -5,14 +5,14 @@ module.exports = {
   internal: {
   internal: {
     contacts: {
     contacts: {
       port: 3036,
       port: 3036,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 
   mongo: {
   mongo: {
     url:
     url:
       process.env.MONGO_CONNECTION_STRING ||
       process.env.MONGO_CONNECTION_STRING ||
-      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
+      `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
     options: {
     options: {
       monitorCommands: true,
       monitorCommands: true,
     },
     },

+ 2 - 2
services/contacts/test/acceptance/js/GettingContactsTests.js

@@ -3,11 +3,11 @@ import request from 'request'
 import async from 'async'
 import async from 'async'
 import { app } from '../../../app/js/server.js'
 import { app } from '../../../app/js/server.js'
 
 
-const HOST = 'http://localhost:3036'
+const HOST = 'http://127.0.0.1:3036'
 
 
 describe('Getting Contacts', function () {
 describe('Getting Contacts', function () {
   before(function (done) {
   before(function (done) {
-    this.server = app.listen(3036, 'localhost', error => {
+    this.server = app.listen(3036, '127.0.0.1', error => {
       if (error != null) {
       if (error != null) {
         throw error
         throw error
       }
       }

+ 1 - 1
services/docstore/app/js/HealthChecker.js

@@ -19,7 +19,7 @@ module.exports = {
   check(callback) {
   check(callback) {
     const docId = new ObjectId()
     const docId = new ObjectId()
     const projectId = new ObjectId(settings.docstore.healthCheck.project_id)
     const projectId = new ObjectId(settings.docstore.healthCheck.project_id)
-    const url = `http://localhost:${port}/project/${projectId}/doc/${docId}`
+    const url = `http://127.0.0.1:${port}/project/${projectId}/doc/${docId}`
     const lines = [
     const lines = [
       'smoke test - delete me',
       'smoke test - delete me',
       `${crypto.randomBytes(32).toString('hex')}`,
       `${crypto.randomBytes(32).toString('hex')}`,

+ 1 - 1
services/docstore/config/settings.defaults.js

@@ -5,7 +5,7 @@ const Settings = {
   internal: {
   internal: {
     docstore: {
     docstore: {
       port: 3016,
       port: 3016,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 

+ 1 - 1
services/docstore/test/acceptance/js/helpers/DocstoreApp.js

@@ -14,7 +14,7 @@ module.exports = {
     }
     }
     this.initing = true
     this.initing = true
     this.callbacks.push(callback)
     this.callbacks.push(callback)
-    app.listen(settings.internal.docstore.port, 'localhost', error => {
+    app.listen(settings.internal.docstore.port, '127.0.0.1', error => {
       if (error != null) {
       if (error != null) {
         throw error
         throw error
       }
       }

+ 11 - 11
services/docstore/test/acceptance/js/helpers/DocstoreClient.js

@@ -33,7 +33,7 @@ module.exports = DocstoreClient = {
   getDoc(projectId, docId, qs, callback) {
   getDoc(projectId, docId, qs, callback) {
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
         json: true,
         json: true,
         qs,
         qs,
       },
       },
@@ -44,7 +44,7 @@ module.exports = DocstoreClient = {
   peekDoc(projectId, docId, qs, callback) {
   peekDoc(projectId, docId, qs, callback) {
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/peek`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/peek`,
         json: true,
         json: true,
         qs,
         qs,
       },
       },
@@ -55,7 +55,7 @@ module.exports = DocstoreClient = {
   isDocDeleted(projectId, docId, callback) {
   isDocDeleted(projectId, docId, callback) {
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/deleted`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/deleted`,
         json: true,
         json: true,
       },
       },
       callback
       callback
@@ -65,7 +65,7 @@ module.exports = DocstoreClient = {
   getAllDocs(projectId, callback) {
   getAllDocs(projectId, callback) {
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc`,
         json: true,
         json: true,
       },
       },
       (req, res, body) => {
       (req, res, body) => {
@@ -77,7 +77,7 @@ module.exports = DocstoreClient = {
   getAllDeletedDocs(projectId, callback) {
   getAllDeletedDocs(projectId, callback) {
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc-deleted`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc-deleted`,
         json: true,
         json: true,
       },
       },
       (error, res, body) => {
       (error, res, body) => {
@@ -93,7 +93,7 @@ module.exports = DocstoreClient = {
   getAllRanges(projectId, callback) {
   getAllRanges(projectId, callback) {
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/ranges`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/ranges`,
         json: true,
         json: true,
       },
       },
       callback
       callback
@@ -103,7 +103,7 @@ module.exports = DocstoreClient = {
   updateDoc(projectId, docId, lines, version, ranges, callback) {
   updateDoc(projectId, docId, lines, version, ranges, callback) {
     return request.post(
     return request.post(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
         json: {
         json: {
           lines,
           lines,
           version,
           version,
@@ -147,7 +147,7 @@ module.exports = DocstoreClient = {
   deleteDocWithDateAndName(projectId, docId, deletedAt, name, callback) {
   deleteDocWithDateAndName(projectId, docId, deletedAt, name, callback) {
     request.patch(
     request.patch(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
         json: { name, deleted: true, deletedAt },
         json: { name, deleted: true, deletedAt },
       },
       },
       callback
       callback
@@ -157,7 +157,7 @@ module.exports = DocstoreClient = {
   archiveAllDoc(projectId, callback) {
   archiveAllDoc(projectId, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/archive`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/archive`,
       },
       },
       callback
       callback
     )
     )
@@ -166,7 +166,7 @@ module.exports = DocstoreClient = {
   archiveDoc(projectId, docId, callback) {
   archiveDoc(projectId, docId, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/archive`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/archive`,
       },
       },
       callback
       callback
     )
     )
@@ -175,7 +175,7 @@ module.exports = DocstoreClient = {
   destroyAllDoc(projectId, callback) {
   destroyAllDoc(projectId, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/destroy`,
+        url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/destroy`,
       },
       },
       callback
       callback
     )
     )

+ 1 - 1
services/document-updater/app.js

@@ -245,7 +245,7 @@ const port =
     Settings.api.documentupdater &&
     Settings.api.documentupdater &&
     Settings.api.documentupdater.port) ||
     Settings.api.documentupdater.port) ||
   3003
   3003
-const host = Settings.internal.documentupdater.host || 'localhost'
+const host = Settings.internal.documentupdater.host || '127.0.0.1'
 
 
 if (!module.parent) {
 if (!module.parent) {
   // Called directly
   // Called directly

+ 8 - 8
services/document-updater/config/settings.defaults.js

@@ -1,7 +1,7 @@
 module.exports = {
 module.exports = {
   internal: {
   internal: {
     documentupdater: {
     documentupdater: {
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
       port: 3003,
       port: 3003,
     },
     },
   },
   },
@@ -9,20 +9,20 @@ module.exports = {
   apis: {
   apis: {
     web: {
     web: {
       url: `http://${
       url: `http://${
-        process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
+        process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
       }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
       }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
       user: process.env.WEB_API_USER || 'overleaf',
       user: process.env.WEB_API_USER || 'overleaf',
       pass: process.env.WEB_API_PASSWORD || 'password',
       pass: process.env.WEB_API_PASSWORD || 'password',
     },
     },
     project_history: {
     project_history: {
-      url: `http://${process.env.PROJECT_HISTORY_HOST || 'localhost'}:3054`,
+      url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
     },
     },
   },
   },
 
 
   redis: {
   redis: {
     pubsub: {
     pubsub: {
       host:
       host:
-        process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
+        process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
       port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
       port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
       password:
       password:
         process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
         process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
@@ -34,7 +34,7 @@ module.exports = {
     history: {
     history: {
       port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || '6379',
       port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || '6379',
       host:
       host:
-        process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
+        process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
       password:
       password:
         process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
         process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
       maxRetriesPerRequest: parseInt(
       maxRetriesPerRequest: parseInt(
@@ -45,7 +45,7 @@ module.exports = {
     project_history: {
     project_history: {
       port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || '6379',
       port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || '6379',
       host:
       host:
-        process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
+        process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
       password:
       password:
         process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
         process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
       maxRetriesPerRequest: parseInt(
       maxRetriesPerRequest: parseInt(
@@ -64,7 +64,7 @@ module.exports = {
     lock: {
     lock: {
       port: process.env.LOCK_REDIS_PORT || process.env.REDIS_PORT || '6379',
       port: process.env.LOCK_REDIS_PORT || process.env.REDIS_PORT || '6379',
       host:
       host:
-        process.env.LOCK_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
+        process.env.LOCK_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
       password:
       password:
         process.env.LOCK_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
         process.env.LOCK_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
       maxRetriesPerRequest: parseInt(
       maxRetriesPerRequest: parseInt(
@@ -83,7 +83,7 @@ module.exports = {
       host:
       host:
         process.env.DOC_UPDATER_REDIS_HOST ||
         process.env.DOC_UPDATER_REDIS_HOST ||
         process.env.REDIS_HOST ||
         process.env.REDIS_HOST ||
-        'localhost',
+        '127.0.0.1',
       password:
       password:
         process.env.DOC_UPDATER_REDIS_PASSWORD ||
         process.env.DOC_UPDATER_REDIS_PASSWORD ||
         process.env.REDIS_PASSWORD ||
         process.env.REDIS_PASSWORD ||

+ 1 - 1
services/document-updater/test/acceptance/js/helpers/DocUpdaterApp.js

@@ -26,7 +26,7 @@ module.exports = {
     }
     }
     this.initing = true
     this.initing = true
     this.callbacks.push(callback)
     this.callbacks.push(callback)
-    app.listen(3003, 'localhost', error => {
+    app.listen(3003, '127.0.0.1', error => {
       if (error != null) {
       if (error != null) {
         throw error
         throw error
       }
       }

+ 15 - 15
services/document-updater/test/acceptance/js/helpers/DocUpdaterClient.js

@@ -97,7 +97,7 @@ module.exports = DocUpdaterClient = {
 
 
   getDoc(projectId, docId, callback) {
   getDoc(projectId, docId, callback) {
     request.get(
     request.get(
-      `http://localhost:3003/project/${projectId}/doc/${docId}`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}`,
       (error, res, body) => {
       (error, res, body) => {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
           body = JSON.parse(body)
           body = JSON.parse(body)
@@ -109,7 +109,7 @@ module.exports = DocUpdaterClient = {
 
 
   getDocAndRecentOps(projectId, docId, fromVersion, callback) {
   getDocAndRecentOps(projectId, docId, fromVersion, callback) {
     request.get(
     request.get(
-      `http://localhost:3003/project/${projectId}/doc/${docId}?fromVersion=${fromVersion}`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}?fromVersion=${fromVersion}`,
       (error, res, body) => {
       (error, res, body) => {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
           body = JSON.parse(body)
           body = JSON.parse(body)
@@ -129,7 +129,7 @@ module.exports = DocUpdaterClient = {
 
 
   peekDoc(projectId, docId, callback) {
   peekDoc(projectId, docId, callback) {
     request.get(
     request.get(
-      `http://localhost:3003/project/${projectId}/doc/${docId}/peek`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}/peek`,
       (error, res, body) => {
       (error, res, body) => {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
           body = JSON.parse(body)
           body = JSON.parse(body)
@@ -141,7 +141,7 @@ module.exports = DocUpdaterClient = {
 
 
   flushDoc(projectId, docId, callback) {
   flushDoc(projectId, docId, callback) {
     request.post(
     request.post(
-      `http://localhost:3003/project/${projectId}/doc/${docId}/flush`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}/flush`,
       (error, res, body) => callback(error, res, body)
       (error, res, body) => callback(error, res, body)
     )
     )
   },
   },
@@ -149,7 +149,7 @@ module.exports = DocUpdaterClient = {
   setDocLines(projectId, docId, lines, source, userId, undoing, callback) {
   setDocLines(projectId, docId, lines, source, userId, undoing, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:3003/project/${projectId}/doc/${docId}`,
+        url: `http://127.0.0.1:3003/project/${projectId}/doc/${docId}`,
         json: {
         json: {
           lines,
           lines,
           source,
           source,
@@ -163,36 +163,36 @@ module.exports = DocUpdaterClient = {
 
 
   deleteDoc(projectId, docId, callback) {
   deleteDoc(projectId, docId, callback) {
     request.del(
     request.del(
-      `http://localhost:3003/project/${projectId}/doc/${docId}`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}`,
       (error, res, body) => callback(error, res, body)
       (error, res, body) => callback(error, res, body)
     )
     )
   },
   },
 
 
   flushProject(projectId, callback) {
   flushProject(projectId, callback) {
-    request.post(`http://localhost:3003/project/${projectId}/flush`, callback)
+    request.post(`http://127.0.0.1:3003/project/${projectId}/flush`, callback)
   },
   },
 
 
   deleteProject(projectId, callback) {
   deleteProject(projectId, callback) {
-    request.del(`http://localhost:3003/project/${projectId}`, callback)
+    request.del(`http://127.0.0.1:3003/project/${projectId}`, callback)
   },
   },
 
 
   deleteProjectOnShutdown(projectId, callback) {
   deleteProjectOnShutdown(projectId, callback) {
     request.del(
     request.del(
-      `http://localhost:3003/project/${projectId}?background=true&shutdown=true`,
+      `http://127.0.0.1:3003/project/${projectId}?background=true&shutdown=true`,
       callback
       callback
     )
     )
   },
   },
 
 
   flushOldProjects(callback) {
   flushOldProjects(callback) {
     request.get(
     request.get(
-      'http://localhost:3003/flush_queued_projects?min_delete_age=1',
+      'http://127.0.0.1:3003/flush_queued_projects?min_delete_age=1',
       callback
       callback
     )
     )
   },
   },
 
 
   acceptChange(projectId, docId, changeId, callback) {
   acceptChange(projectId, docId, changeId, callback) {
     request.post(
     request.post(
-      `http://localhost:3003/project/${projectId}/doc/${docId}/change/${changeId}/accept`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}/change/${changeId}/accept`,
       callback
       callback
     )
     )
   },
   },
@@ -200,7 +200,7 @@ module.exports = DocUpdaterClient = {
   acceptChanges(projectId, docId, changeIds, callback) {
   acceptChanges(projectId, docId, changeIds, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:3003/project/${projectId}/doc/${docId}/change/accept`,
+        url: `http://127.0.0.1:3003/project/${projectId}/doc/${docId}/change/accept`,
         json: { change_ids: changeIds },
         json: { change_ids: changeIds },
       },
       },
       callback
       callback
@@ -209,14 +209,14 @@ module.exports = DocUpdaterClient = {
 
 
   removeComment(projectId, docId, comment, callback) {
   removeComment(projectId, docId, comment, callback) {
     request.del(
     request.del(
-      `http://localhost:3003/project/${projectId}/doc/${docId}/comment/${comment}`,
+      `http://127.0.0.1:3003/project/${projectId}/doc/${docId}/comment/${comment}`,
       callback
       callback
     )
     )
   },
   },
 
 
   getProjectDocs(projectId, projectStateHash, callback) {
   getProjectDocs(projectId, projectStateHash, callback) {
     request.get(
     request.get(
-      `http://localhost:3003/project/${projectId}/doc?state=${projectStateHash}`,
+      `http://127.0.0.1:3003/project/${projectId}/doc?state=${projectStateHash}`,
       (error, res, body) => {
       (error, res, body) => {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
         if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
           body = JSON.parse(body)
           body = JSON.parse(body)
@@ -229,7 +229,7 @@ module.exports = DocUpdaterClient = {
   sendProjectUpdate(projectId, userId, updates, version, callback) {
   sendProjectUpdate(projectId, userId, updates, version, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:3003/project/${projectId}`,
+        url: `http://127.0.0.1:3003/project/${projectId}`,
         json: { userId, updates, version },
         json: { userId, updates, version },
       },
       },
       (error, res, body) => callback(error, res, body)
       (error, res, body) => callback(error, res, body)

+ 2 - 2
services/document-updater/test/cluster_failover/js/test_blpop_failover.js

@@ -4,7 +4,7 @@ const rclient1 = redis.createClient({
   cluster: [
   cluster: [
     {
     {
       port: '7000',
       port: '7000',
-      host: 'localhost',
+      host: '127.0.0.1',
     },
     },
   ],
   ],
 })
 })
@@ -13,7 +13,7 @@ const rclient2 = redis.createClient({
   cluster: [
   cluster: [
     {
     {
       port: '7000',
       port: '7000',
-      host: 'localhost',
+      host: '127.0.0.1',
     },
     },
   ],
   ],
 })
 })

+ 2 - 2
services/document-updater/test/cluster_failover/js/test_pubsub_failover.js

@@ -4,7 +4,7 @@ const rclient1 = redis.createClient({
   cluster: [
   cluster: [
     {
     {
       port: '7000',
       port: '7000',
-      host: 'localhost',
+      host: '127.0.0.1',
     },
     },
   ],
   ],
 })
 })
@@ -13,7 +13,7 @@ const rclient2 = redis.createClient({
   cluster: [
   cluster: [
     {
     {
       port: '7000',
       port: '7000',
-      host: 'localhost',
+      host: '127.0.0.1',
     },
     },
   ],
   ],
 })
 })

+ 1 - 1
services/filestore/config/settings.defaults.js

@@ -37,7 +37,7 @@ const settings = {
   internal: {
   internal: {
     filestore: {
     filestore: {
       port: 3009,
       port: 3009,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 

+ 1 - 1
services/filestore/test/acceptance/deps/Dockerfile.fake-gcs

@@ -1,5 +1,5 @@
 FROM fsouza/fake-gcs-server:1.20
 FROM fsouza/fake-gcs-server:1.20
 RUN apk add --update --no-cache curl
 RUN apk add --update --no-cache curl
 COPY healthcheck.sh /healthcheck.sh
 COPY healthcheck.sh /healthcheck.sh
-HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://localhost:9090
+HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://127.0.0.1:9090
 CMD ["--port=9090", "--scheme=http"]
 CMD ["--port=9090", "--scheme=http"]

+ 1 - 1
services/filestore/test/acceptance/deps/Dockerfile.s3mock

@@ -1,4 +1,4 @@
 FROM adobe/s3mock:2.4.14
 FROM adobe/s3mock:2.4.14
 RUN apk add --update --no-cache curl
 RUN apk add --update --no-cache curl
 COPY healthcheck.sh /healthcheck.sh
 COPY healthcheck.sh /healthcheck.sh
-HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://localhost:9090
+HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://127.0.0.1:9090

+ 1 - 1
services/filestore/test/acceptance/js/FilestoreApp.js

@@ -32,7 +32,7 @@ class FilestoreApp {
     await new Promise((resolve, reject) => {
     await new Promise((resolve, reject) => {
       this.server = this.app.listen(
       this.server = this.app.listen(
         Settings.internal.filestore.port,
         Settings.internal.filestore.port,
-        'localhost',
+        '127.0.0.1',
         err => {
         err => {
           if (err) {
           if (err) {
             return reject(err)
             return reject(err)

+ 1 - 1
services/filestore/test/acceptance/js/FilestoreTests.js

@@ -36,7 +36,7 @@ const BackendSettings = require('./TestConfig')
 
 
 describe('Filestore', function () {
 describe('Filestore', function () {
   this.timeout(1000 * 10)
   this.timeout(1000 * 10)
-  const filestoreUrl = `http://localhost:${Settings.internal.filestore.port}`
+  const filestoreUrl = `http://127.0.0.1:${Settings.internal.filestore.port}`
 
 
   const seenSockets = []
   const seenSockets = []
   async function expectNoSockets() {
   async function expectNoSockets() {

+ 1 - 1
services/history-v1/test/acceptance/js/api/support/test_server.js

@@ -16,7 +16,7 @@ const Swagger = require('swagger-client')
 const app = require('../../../../../app')
 const app = require('../../../../../app')
 
 
 function testUrl(pathname, opts = {}) {
 function testUrl(pathname, opts = {}) {
-  const url = new URL('http://localhost')
+  const url = new URL('http://127.0.0.1')
   url.port = exports.server.address().port
   url.port = exports.server.address().port
   url.pathname = pathname
   url.pathname = pathname
   if (opts.qs) {
   if (opts.qs) {

+ 1 - 1
services/notifications/app.js

@@ -49,7 +49,7 @@ app.get('/health_check', (req, res) =>
 
 
 app.get('*', (req, res) => res.sendStatus(404))
 app.get('*', (req, res) => res.sendStatus(404))
 
 
-const host = Settings.internal?.notifications?.host || 'localhost'
+const host = Settings.internal?.notifications?.host || '127.0.0.1'
 const port = Settings.internal?.notifications?.port || 3042
 const port = Settings.internal?.notifications?.port || 3042
 
 
 mongoClient
 mongoClient

+ 1 - 1
services/notifications/app/js/HealthCheckController.js

@@ -24,7 +24,7 @@ module.exports = {
 
 
     let notificationKey = `smoke-test-notification-${new ObjectId()}`
     let notificationKey = `smoke-test-notification-${new ObjectId()}`
     const getOpts = endPath => ({
     const getOpts = endPath => ({
-      url: `http://localhost:${port}/user/${userId}${endPath}`,
+      url: `http://127.0.0.1:${port}/user/${userId}${endPath}`,
       timeout: 5000,
       timeout: 5000,
     })
     })
     logger.debug(
     logger.debug(

+ 2 - 2
services/notifications/config/settings.defaults.js

@@ -2,14 +2,14 @@ module.exports = {
   internal: {
   internal: {
     notifications: {
     notifications: {
       port: 3042,
       port: 3042,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 
   mongo: {
   mongo: {
     url:
     url:
       process.env.MONGO_CONNECTION_STRING ||
       process.env.MONGO_CONNECTION_STRING ||
-      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
+      `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
     options: {
     options: {
       monitorCommands: true,
       monitorCommands: true,
     },
     },

+ 2 - 2
services/project-history/app/js/HealthChecker.js

@@ -18,12 +18,12 @@ const { port } = settings.internal.history
 
 
 export function check(callback) {
 export function check(callback) {
   const projectId = new ObjectId(settings.history.healthCheck.project_id)
   const projectId = new ObjectId(settings.history.healthCheck.project_id)
-  const url = `http://localhost:${port}/project/${projectId}`
+  const url = `http://127.0.0.1:${port}/project/${projectId}`
   logger.debug({ projectId }, 'running health check')
   logger.debug({ projectId }, 'running health check')
   const jobs = [
   const jobs = [
     cb =>
     cb =>
       request.get(
       request.get(
-        { url: `http://localhost:${port}/check_lock`, timeout: 3000 },
+        { url: `http://127.0.0.1:${port}/check_lock`, timeout: 3000 },
         function (err, res, body) {
         function (err, res, body) {
           if (err != null) {
           if (err != null) {
             OError.tag(err, 'error checking lock for health check', {
             OError.tag(err, 'error checking lock for health check', {

+ 9 - 9
services/project-history/config/settings.defaults.cjs

@@ -2,7 +2,7 @@ module.exports = {
   mongo: {
   mongo: {
     url:
     url:
       process.env.MONGO_CONNECTION_STRING ||
       process.env.MONGO_CONNECTION_STRING ||
-      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
+      `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
     options: {
     options: {
       monitorCommands: true,
       monitorCommands: true,
     },
     },
@@ -10,25 +10,25 @@ module.exports = {
   internal: {
   internal: {
     history: {
     history: {
       port: 3054,
       port: 3054,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
   apis: {
   apis: {
     documentupdater: {
     documentupdater: {
-      url: `http://${process.env.DOCUPDATER_HOST || 'localhost'}:3003`,
+      url: `http://${process.env.DOCUPDATER_HOST || '127.0.0.1'}:3003`,
     },
     },
     docstore: {
     docstore: {
-      url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
+      url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
     },
     },
     filestore: {
     filestore: {
-      url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
+      url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
     },
     },
     history_v1: {
     history_v1: {
       requestTimeout: parseInt(process.env.V1_REQUEST_TIMEOUT || '300000', 10),
       requestTimeout: parseInt(process.env.V1_REQUEST_TIMEOUT || '300000', 10),
     },
     },
     web: {
     web: {
       url: `http://${
       url: `http://${
-        process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
+        process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
       }:${process.env.WEB_PORT || 3000}`,
       }:${process.env.WEB_PORT || 3000}`,
       user: process.env.WEB_API_USER || 'overleaf',
       user: process.env.WEB_API_USER || 'overleaf',
       pass: process.env.WEB_API_PASSWORD || 'password',
       pass: process.env.WEB_API_PASSWORD || 'password',
@@ -40,7 +40,7 @@ module.exports = {
   },
   },
   redis: {
   redis: {
     lock: {
     lock: {
-      host: process.env.REDIS_HOST || 'localhost',
+      host: process.env.REDIS_HOST || '127.0.0.1',
       password: process.env.REDIS_PASSWORD,
       password: process.env.REDIS_PASSWORD,
       port: process.env.REDIS_PORT || 6379,
       port: process.env.REDIS_PORT || 6379,
       key_schema: {
       key_schema: {
@@ -51,7 +51,7 @@ module.exports = {
     },
     },
     project_history: {
     project_history: {
       host:
       host:
-        process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
+        process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
       port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || 6379,
       port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || 6379,
       password:
       password:
         process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD,
         process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD,
@@ -82,7 +82,7 @@ module.exports = {
         `http://${
         `http://${
           process.env.V1_HISTORY_HOST ||
           process.env.V1_HISTORY_HOST ||
           process.env.HISTORY_V1_HOST ||
           process.env.HISTORY_V1_HOST ||
-          'localhost'
+          '127.0.0.1'
         }:3100/api`,
         }:3100/api`,
       user: process.env.V1_HISTORY_USER || 'staging',
       user: process.env.V1_HISTORY_USER || 'staging',
       pass: process.env.V1_HISTORY_PASSWORD || 'password',
       pass: process.env.V1_HISTORY_PASSWORD || 'password',

+ 2 - 2
services/project-history/test/acceptance/js/DeleteProjectTests.js

@@ -5,8 +5,8 @@ import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 
 
 describe('Deleting project', function () {
 describe('Deleting project', function () {

+ 3 - 3
services/project-history/test/acceptance/js/DiffTests.js

@@ -7,8 +7,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 function createMockBlob(historyId, content) {
 function createMockBlob(historyId, content) {
   const sha = crypto.createHash('sha1').update(content).digest('hex')
   const sha = crypto.createHash('sha1').update(content).digest('hex')
@@ -316,7 +316,7 @@ describe('Diffs', function () {
 
 
     request.get(
     request.get(
       {
       {
-        url: `http://localhost:3054/project/${this.projectId}/diff`,
+        url: `http://127.0.0.1:3054/project/${this.projectId}/diff`,
         qs: {
         qs: {
           pathname: 'not_here.tex',
           pathname: 'not_here.tex',
           from: 3,
           from: 3,

+ 2 - 2
services/project-history/test/acceptance/js/DiscardingUpdatesTests.js

@@ -21,8 +21,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 describe('DiscardingUpdates', function () {
 describe('DiscardingUpdates', function () {
   beforeEach(function (done) {
   beforeEach(function (done) {

+ 3 - 3
services/project-history/test/acceptance/js/FileTreeDiffTests.js

@@ -24,9 +24,9 @@ import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as HistoryId from './helpers/HistoryId.js'
 import * as HistoryId from './helpers/HistoryId.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockFileStore = () => nock('http://localhost:3009')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockFileStore = () => nock('http://127.0.0.1:3009')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 const sha = data => crypto.createHash('sha1').update(data).digest('hex')
 const sha = data => crypto.createHash('sha1').update(data).digest('hex')
 
 

+ 6 - 6
services/project-history/test/acceptance/js/FlushManagerTests.js

@@ -8,8 +8,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 describe('Flushing old queues', function () {
 describe('Flushing old queues', function () {
   const historyId = new ObjectId().toString()
   const historyId = new ObjectId().toString()
@@ -90,7 +90,7 @@ describe('Flushing old queues', function () {
       it('flushes the project history queue', function (done) {
       it('flushes the project history queue', function (done) {
         request.post(
         request.post(
           {
           {
-            url: 'http://localhost:3054/flush/old?maxAge=10800',
+            url: 'http://127.0.0.1:3054/flush/old?maxAge=10800',
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {
@@ -109,7 +109,7 @@ describe('Flushing old queues', function () {
       it('flushes the project history queue in the background when requested', function (done) {
       it('flushes the project history queue in the background when requested', function (done) {
         request.post(
         request.post(
           {
           {
-            url: 'http://localhost:3054/flush/old?maxAge=10800&background=1',
+            url: 'http://127.0.0.1:3054/flush/old?maxAge=10800&background=1',
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {
@@ -166,7 +166,7 @@ describe('Flushing old queues', function () {
       it('does not flush the project history queue', function (done) {
       it('does not flush the project history queue', function (done) {
         request.post(
         request.post(
           {
           {
-            url: `http://localhost:3054/flush/old?maxAge=${3 * 3600}`,
+            url: `http://127.0.0.1:3054/flush/old?maxAge=${3 * 3600}`,
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {
@@ -213,7 +213,7 @@ describe('Flushing old queues', function () {
       it('flushes the project history queue anyway', function (done) {
       it('flushes the project history queue anyway', function (done) {
         request.post(
         request.post(
           {
           {
-            url: `http://localhost:3054/flush/old?maxAge=${3 * 3600}`,
+            url: `http://127.0.0.1:3054/flush/old?maxAge=${3 * 3600}`,
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {

+ 3 - 3
services/project-history/test/acceptance/js/HealthCheckTests.js

@@ -18,8 +18,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 describe('Health Check', function () {
 describe('Health Check', function () {
   beforeEach(function (done) {
   beforeEach(function (done) {
@@ -62,7 +62,7 @@ describe('Health Check', function () {
   return it('should respond to the health check', function (done) {
   return it('should respond to the health check', function (done) {
     return request.get(
     return request.get(
       {
       {
-        url: 'http://localhost:3054/health_check',
+        url: 'http://127.0.0.1:3054/health_check',
       },
       },
       (error, res, body) => {
       (error, res, body) => {
         if (error != null) {
         if (error != null) {

+ 3 - 3
services/project-history/test/acceptance/js/LabelsTests.js

@@ -19,9 +19,9 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockFileStore = () => nock('http://localhost:3009')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockFileStore = () => nock('http://127.0.0.1:3009')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 
 

+ 2 - 2
services/project-history/test/acceptance/js/ReadingASnapshotTests.js

@@ -5,8 +5,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 
 

+ 6 - 6
services/project-history/test/acceptance/js/RetryTests.js

@@ -8,10 +8,10 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
-const MockCallback = () => nock('http://localhost')
+const MockCallback = () => nock('http://127.0.0.1')
 
 
 describe('Retrying failed projects', function () {
 describe('Retrying failed projects', function () {
   const historyId = new ObjectId().toString()
   const historyId = new ObjectId().toString()
@@ -95,7 +95,7 @@ describe('Retrying failed projects', function () {
       it('flushes the project history queue', function (done) {
       it('flushes the project history queue', function (done) {
         request.post(
         request.post(
           {
           {
-            url: 'http://localhost:3054/retry/failures?failureType=soft&limit=1&timeout=10000',
+            url: 'http://127.0.0.1:3054/retry/failures?failureType=soft&limit=1&timeout=10000',
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {
@@ -118,7 +118,7 @@ describe('Retrying failed projects', function () {
           .reply(200)
           .reply(200)
         request.post(
         request.post(
           {
           {
-            url: 'http://localhost:3054/retry/failures?failureType=soft&limit=1&timeout=10000&callbackUrl=http%3A%2F%2Flocalhost%2Fping',
+            url: 'http://127.0.0.1:3054/retry/failures?failureType=soft&limit=1&timeout=10000&callbackUrl=http%3A%2F%2F127.0.0.1%2Fping',
             headers: {
             headers: {
               'X-CALLBACK-Authorization': '123',
               'X-CALLBACK-Authorization': '123',
             },
             },
@@ -177,7 +177,7 @@ describe('Retrying failed projects', function () {
 
 
         request.post(
         request.post(
           {
           {
-            url: 'http://localhost:3054/retry/failures?failureType=hard&limit=1&timeout=10000',
+            url: 'http://127.0.0.1:3054/retry/failures?failureType=hard&limit=1&timeout=10000',
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {

+ 4 - 4
services/project-history/test/acceptance/js/SendingUpdatesTests.js

@@ -9,9 +9,9 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockFileStore = () => nock('http://localhost:3009')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockFileStore = () => nock('http://127.0.0.1:3009')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 // Some helper methods to make the tests more compact
 // Some helper methods to make the tests more compact
 function slTextUpdate(historyId, doc, userId, v, ts, op) {
 function slTextUpdate(historyId, doc, userId, v, ts, op) {
@@ -57,7 +57,7 @@ function slAddFileUpdate(historyId, file, userId, ts, projectId) {
   return {
   return {
     projectHistoryId: historyId,
     projectHistoryId: historyId,
     pathname: file.pathname,
     pathname: file.pathname,
-    url: `http://localhost:3009/project/${projectId}/file/${file.id}`,
+    url: `http://127.0.0.1:3009/project/${projectId}/file/${file.id}`,
     file: file.id,
     file: file.id,
     meta: { user_id: userId, ts: ts.getTime() },
     meta: { user_id: userId, ts: ts.getTime() },
   }
   }

+ 3 - 3
services/project-history/test/acceptance/js/SummarisedUpdatesTests.js

@@ -21,9 +21,9 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
 const { ObjectId } = mongodb
 const { ObjectId } = mongodb
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockFileStore = () => nock('http://localhost:3009')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockFileStore = () => nock('http://127.0.0.1:3009')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
 
 

+ 5 - 5
services/project-history/test/acceptance/js/SyncTests.js

@@ -10,9 +10,9 @@ const { ObjectId } = mongodb
 
 
 const EMPTY_FILE_HASH = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
 const EMPTY_FILE_HASH = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
 
 
-const MockHistoryStore = () => nock('http://localhost:3100')
-const MockFileStore = () => nock('http://localhost:3009')
-const MockWeb = () => nock('http://localhost:3000')
+const MockHistoryStore = () => nock('http://127.0.0.1:3100')
+const MockFileStore = () => nock('http://127.0.0.1:3009')
+const MockWeb = () => nock('http://127.0.0.1:3000')
 
 
 describe('Syncing with web and doc-updater', function () {
 describe('Syncing with web and doc-updater', function () {
   const historyId = new ObjectId().toString()
   const historyId = new ObjectId().toString()
@@ -68,7 +68,7 @@ describe('Syncing with web and doc-updater', function () {
       it('404s if project-history is not enabled', function (done) {
       it('404s if project-history is not enabled', function (done) {
         request.post(
         request.post(
           {
           {
-            url: `http://localhost:3054/project/${this.project_id}/resync`,
+            url: `http://127.0.0.1:3054/project/${this.project_id}/resync`,
           },
           },
           (error, res, body) => {
           (error, res, body) => {
             if (error) {
             if (error) {
@@ -244,7 +244,7 @@ describe('Syncing with web and doc-updater', function () {
                       {
                       {
                         file: this.file_id,
                         file: this.file_id,
                         path: '/test.png',
                         path: '/test.png',
-                        url: `http://localhost:3009/project/${this.project_id}/file/${this.file_id}`,
+                        url: `http://127.0.0.1:3009/project/${this.project_id}/file/${this.file_id}`,
                       },
                       },
                       { path: '/persistedFile' },
                       { path: '/persistedFile' },
                     ],
                     ],

+ 1 - 1
services/project-history/test/acceptance/js/helpers/ProjectHistoryApp.js

@@ -27,7 +27,7 @@ export function ensureRunning(callback) {
   }
   }
   initing = true
   initing = true
   callbacks.push(callback)
   callbacks.push(callback)
-  app.listen(3054, 'localhost', error => {
+  app.listen(3054, '127.0.0.1', error => {
     if (error != null) {
     if (error != null) {
       throw error
       throw error
     }
     }

+ 15 - 15
services/project-history/test/acceptance/js/helpers/ProjectHistoryClient.js

@@ -14,7 +14,7 @@ export function resetDatabase(callback) {
 export function initializeProject(historyId, callback) {
 export function initializeProject(historyId, callback) {
   request.post(
   request.post(
     {
     {
-      url: 'http://localhost:3054/project',
+      url: 'http://127.0.0.1:3054/project',
       json: { historyId },
       json: { historyId },
     },
     },
     (error, res, body) => {
     (error, res, body) => {
@@ -37,7 +37,7 @@ export function flushProject(projectId, options, callback) {
   }
   }
   request.post(
   request.post(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/flush`,
+      url: `http://127.0.0.1:3054/project/${projectId}/flush`,
     },
     },
     (error, res, body) => {
     (error, res, body) => {
       if (error) {
       if (error) {
@@ -54,7 +54,7 @@ export function flushProject(projectId, options, callback) {
 export function getSummarizedUpdates(projectId, query, callback) {
 export function getSummarizedUpdates(projectId, query, callback) {
   request.get(
   request.get(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/updates`,
+      url: `http://127.0.0.1:3054/project/${projectId}/updates`,
       qs: query,
       qs: query,
       json: true,
       json: true,
     },
     },
@@ -71,7 +71,7 @@ export function getSummarizedUpdates(projectId, query, callback) {
 export function getDiff(projectId, pathname, from, to, callback) {
 export function getDiff(projectId, pathname, from, to, callback) {
   request.get(
   request.get(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/diff`,
+      url: `http://127.0.0.1:3054/project/${projectId}/diff`,
       qs: {
       qs: {
         pathname,
         pathname,
         from,
         from,
@@ -92,7 +92,7 @@ export function getDiff(projectId, pathname, from, to, callback) {
 export function getFileTreeDiff(projectId, from, to, callback) {
 export function getFileTreeDiff(projectId, from, to, callback) {
   request.get(
   request.get(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/filetree/diff`,
+      url: `http://127.0.0.1:3054/project/${projectId}/filetree/diff`,
       qs: {
       qs: {
         from,
         from,
         to,
         to,
@@ -118,7 +118,7 @@ export function getSnapshot(projectId, pathname, version, options, callback) {
   }
   }
   request.get(
   request.get(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/version/${version}/${encodeURIComponent(
+      url: `http://127.0.0.1:3054/project/${projectId}/version/${version}/${encodeURIComponent(
         pathname
         pathname
       )}`,
       )}`,
     },
     },
@@ -171,7 +171,7 @@ export function getQueueLength(projectId, callback) {
 export function getQueueCounts(callback) {
 export function getQueueCounts(callback) {
   return request.get(
   return request.get(
     {
     {
-      url: 'http://localhost:3054/status/queue',
+      url: 'http://127.0.0.1:3054/status/queue',
       json: true,
       json: true,
     },
     },
     callback
     callback
@@ -181,7 +181,7 @@ export function getQueueCounts(callback) {
 export function resyncHistory(projectId, callback) {
 export function resyncHistory(projectId, callback) {
   request.post(
   request.post(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/resync`,
+      url: `http://127.0.0.1:3054/project/${projectId}/resync`,
       json: true,
       json: true,
       body: { origin: { kind: 'test-origin' } },
       body: { origin: { kind: 'test-origin' } },
     },
     },
@@ -205,7 +205,7 @@ export function createLabel(
 ) {
 ) {
   request.post(
   request.post(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/user/${userId}/labels`,
+      url: `http://127.0.0.1:3054/project/${projectId}/user/${userId}/labels`,
       json: { comment, version, created_at: createdAt },
       json: { comment, version, created_at: createdAt },
     },
     },
     (error, res, body) => {
     (error, res, body) => {
@@ -221,7 +221,7 @@ export function createLabel(
 export function getLabels(projectId, callback) {
 export function getLabels(projectId, callback) {
   request.get(
   request.get(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/labels`,
+      url: `http://127.0.0.1:3054/project/${projectId}/labels`,
       json: true,
       json: true,
     },
     },
     (error, res, body) => {
     (error, res, body) => {
@@ -237,7 +237,7 @@ export function getLabels(projectId, callback) {
 export function deleteLabelForUser(projectId, userId, labelId, callback) {
 export function deleteLabelForUser(projectId, userId, labelId, callback) {
   request.delete(
   request.delete(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/user/${userId}/labels/${labelId}`,
+      url: `http://127.0.0.1:3054/project/${projectId}/user/${userId}/labels/${labelId}`,
     },
     },
     (error, res, body) => {
     (error, res, body) => {
       if (error) {
       if (error) {
@@ -252,7 +252,7 @@ export function deleteLabelForUser(projectId, userId, labelId, callback) {
 export function deleteLabel(projectId, labelId, callback) {
 export function deleteLabel(projectId, labelId, callback) {
   request.delete(
   request.delete(
     {
     {
-      url: `http://localhost:3054/project/${projectId}/labels/${labelId}`,
+      url: `http://127.0.0.1:3054/project/${projectId}/labels/${labelId}`,
     },
     },
     (error, res, body) => {
     (error, res, body) => {
       if (error) {
       if (error) {
@@ -279,7 +279,7 @@ export function setFailure(failureEntry, callback) {
 export function transferLabelOwnership(fromUser, toUser, callback) {
 export function transferLabelOwnership(fromUser, toUser, callback) {
   request.post(
   request.post(
     {
     {
-      url: `http://localhost:3054/user/${fromUser}/labels/transfer/${toUser}`,
+      url: `http://127.0.0.1:3054/user/${fromUser}/labels/transfer/${toUser}`,
     },
     },
     (error, res, body) => {
     (error, res, body) => {
       if (error) {
       if (error) {
@@ -293,7 +293,7 @@ export function transferLabelOwnership(fromUser, toUser, callback) {
 
 
 export function getDump(projectId, callback) {
 export function getDump(projectId, callback) {
   request.get(
   request.get(
-    `http://localhost:3054/project/${projectId}/dump`,
+    `http://127.0.0.1:3054/project/${projectId}/dump`,
     (err, res, body) => {
     (err, res, body) => {
       if (err) {
       if (err) {
         return callback(err)
         return callback(err)
@@ -305,7 +305,7 @@ export function getDump(projectId, callback) {
 }
 }
 
 
 export function deleteProject(projectId, callback) {
 export function deleteProject(projectId, callback) {
-  request.delete(`http://localhost:3054/project/${projectId}`, (err, res) => {
+  request.delete(`http://127.0.0.1:3054/project/${projectId}`, (err, res) => {
     if (err) {
     if (err) {
       return callback(err)
       return callback(err)
     }
     }

+ 7 - 7
services/real-time/config/settings.defaults.js

@@ -4,7 +4,7 @@ const settings = {
   redis: {
   redis: {
     pubsub: {
     pubsub: {
       host:
       host:
-        process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
+        process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
       port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
       port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
       password:
       password:
         process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
         process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
@@ -19,7 +19,7 @@ const settings = {
       host:
       host:
         process.env.REAL_TIME_REDIS_HOST ||
         process.env.REAL_TIME_REDIS_HOST ||
         process.env.REDIS_HOST ||
         process.env.REDIS_HOST ||
-        'localhost',
+        '127.0.0.1',
       port:
       port:
         process.env.REAL_TIME_REDIS_PORT || process.env.REDIS_PORT || '6379',
         process.env.REAL_TIME_REDIS_PORT || process.env.REDIS_PORT || '6379',
       password:
       password:
@@ -45,7 +45,7 @@ const settings = {
       host:
       host:
         process.env.DOC_UPDATER_REDIS_HOST ||
         process.env.DOC_UPDATER_REDIS_HOST ||
         process.env.REDIS_HOST ||
         process.env.REDIS_HOST ||
-        'localhost',
+        '127.0.0.1',
       port:
       port:
         process.env.DOC_UPDATER_REDIS_PORT || process.env.REDIS_PORT || '6379',
         process.env.DOC_UPDATER_REDIS_PORT || process.env.REDIS_PORT || '6379',
       password:
       password:
@@ -68,7 +68,7 @@ const settings = {
       host:
       host:
         process.env.SESSIONS_REDIS_HOST ||
         process.env.SESSIONS_REDIS_HOST ||
         process.env.REDIS_HOST ||
         process.env.REDIS_HOST ||
-        'localhost',
+        '127.0.0.1',
       port: process.env.SESSIONS_REDIS_PORT || process.env.REDIS_PORT || '6379',
       port: process.env.SESSIONS_REDIS_PORT || process.env.REDIS_PORT || '6379',
       password:
       password:
         process.env.SESSIONS_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
         process.env.SESSIONS_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
@@ -83,14 +83,14 @@ const settings = {
   internal: {
   internal: {
     realTime: {
     realTime: {
       port: 3026,
       port: 3026,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 
   apis: {
   apis: {
     web: {
     web: {
       url: `http://${
       url: `http://${
-        process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
+        process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
       }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
       }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
       user: process.env.WEB_API_USER || 'overleaf',
       user: process.env.WEB_API_USER || 'overleaf',
       pass: process.env.WEB_API_PASSWORD || 'password',
       pass: process.env.WEB_API_PASSWORD || 'password',
@@ -99,7 +99,7 @@ const settings = {
       url: `http://${
       url: `http://${
         process.env.DOCUMENT_UPDATER_HOST ||
         process.env.DOCUMENT_UPDATER_HOST ||
         process.env.DOCUPDATER_HOST ||
         process.env.DOCUPDATER_HOST ||
-        'localhost'
+        '127.0.0.1'
       }:3003`,
       }:3003`,
     },
     },
   },
   },

+ 1 - 1
services/real-time/test/acceptance/js/DrainManagerTests.js

@@ -16,7 +16,7 @@ const request = require('request')
 const drain = function (rate, callback) {
 const drain = function (rate, callback) {
   request.post(
   request.post(
     {
     {
-      url: `http://localhost:3026/drain?rate=${rate}`,
+      url: `http://127.0.0.1:3026/drain?rate=${rate}`,
     },
     },
     (error, response, data) => callback(error, data)
     (error, response, data) => callback(error, data)
   )
   )

+ 1 - 1
services/real-time/test/acceptance/js/HttpControllerTests.js

@@ -8,7 +8,7 @@
 const async = require('async')
 const async = require('async')
 const { expect } = require('chai')
 const { expect } = require('chai')
 const request = require('request').defaults({
 const request = require('request').defaults({
-  baseUrl: 'http://localhost:3026',
+  baseUrl: 'http://127.0.0.1:3026',
 })
 })
 
 
 const RealTimeClient = require('./helpers/RealTimeClient')
 const RealTimeClient = require('./helpers/RealTimeClient')

+ 4 - 4
services/real-time/test/acceptance/js/helpers/RealTimeClient.js

@@ -74,7 +74,7 @@ module.exports = Client = {
   },
   },
 
 
   connect(projectId, callback) {
   connect(projectId, callback) {
-    const client = io.connect('http://localhost:3026', {
+    const client = io.connect('http://127.0.0.1:3026', {
       'force new connection': true,
       'force new connection': true,
       query: new URLSearchParams({ projectId }).toString(),
       query: new URLSearchParams({ projectId }).toString(),
     })
     })
@@ -105,7 +105,7 @@ module.exports = Client = {
     }
     }
     return request.get(
     return request.get(
       {
       {
-        url: 'http://localhost:3026/clients',
+        url: 'http://127.0.0.1:3026/clients',
         json: true,
         json: true,
       },
       },
       (error, response, data) => callback(error, data)
       (error, response, data) => callback(error, data)
@@ -118,7 +118,7 @@ module.exports = Client = {
     }
     }
     return request.get(
     return request.get(
       {
       {
-        url: `http://localhost:3026/clients/${clientId}`,
+        url: `http://127.0.0.1:3026/clients/${clientId}`,
         json: true,
         json: true,
       },
       },
       (error, response, data) => {
       (error, response, data) => {
@@ -134,7 +134,7 @@ module.exports = Client = {
   disconnectClient(clientId, callback) {
   disconnectClient(clientId, callback) {
     request.post(
     request.post(
       {
       {
-        url: `http://localhost:3026/client/${clientId}/disconnect`,
+        url: `http://127.0.0.1:3026/client/${clientId}/disconnect`,
       },
       },
       (error, response, data) => callback(error, data)
       (error, response, data) => callback(error, data)
     )
     )

+ 1 - 1
services/real-time/test/acceptance/js/helpers/RealtimeServer.js

@@ -33,7 +33,7 @@ module.exports = {
           Settings.internal != null ? Settings.internal.realtime : undefined,
           Settings.internal != null ? Settings.internal.realtime : undefined,
           x => x.port
           x => x.port
         ),
         ),
-        'localhost',
+        '127.0.0.1',
         error => {
         error => {
           if (error != null) {
           if (error != null) {
             throw error
             throw error

+ 3 - 3
services/real-time/test/acceptance/libs/XMLHttpRequest.js

@@ -273,7 +273,7 @@ exports.XMLHttpRequest = function () {
 
 
       case undefined:
       case undefined:
       case '':
       case '':
-        host = 'localhost'
+        host = '127.0.0.1'
         break
         break
 
 
       default:
       default:
@@ -309,8 +309,8 @@ exports.XMLHttpRequest = function () {
       return
       return
     }
     }
 
 
-    // Default to port 80. If accessing localhost on another port be sure
-    // to use http://localhost:port/path
+    // Default to port 80. If accessing 127.0.0.1 on another port be sure
+    // to use http://127.0.0.1:port/path
     const port = url.port || (ssl ? 443 : 80)
     const port = url.port || (ssl ? 443 : 80)
     // Add query string if one is used
     // Add query string if one is used
     const uri = url.pathname + (url.search ? url.search : '')
     const uri = url.pathname + (url.search ? url.search : '')

+ 1 - 1
services/spelling/app.js

@@ -7,7 +7,7 @@ import { app } from './app/js/server.js'
 import * as ASpell from './app/js/ASpell.js'
 import * as ASpell from './app/js/ASpell.js'
 import Metrics from '@overleaf/metrics'
 import Metrics from '@overleaf/metrics'
 
 
-const { host = 'localhost', port = 3005 } = Settings.internal?.spelling ?? {}
+const { host = '127.0.0.1', port = 3005 } = Settings.internal?.spelling ?? {}
 
 
 ASpell.startCacheDump()
 ASpell.startCacheDump()
 
 

+ 1 - 1
services/spelling/app/js/HealthCheckController.js

@@ -5,7 +5,7 @@ import OError from '@overleaf/o-error'
 
 
 export function healthCheck(req, res) {
 export function healthCheck(req, res) {
   const opts = {
   const opts = {
-    url: `http://localhost:3005/user/${settings.healthCheckUserId}/check`,
+    url: `http://127.0.0.1:3005/user/${settings.healthCheckUserId}/check`,
     json: {
     json: {
       words: ['helllo'],
       words: ['helllo'],
       language: 'en',
       language: 'en',

+ 1 - 1
services/spelling/config/settings.defaults.cjs

@@ -4,7 +4,7 @@ module.exports = {
   internal: {
   internal: {
     spelling: {
     spelling: {
       port: 3005,
       port: 3005,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 

+ 1 - 1
services/spelling/test/acceptance/js/Init.js

@@ -2,5 +2,5 @@ import { app } from '../../../app/js/server.js'
 import { PORT } from './helpers/request.js'
 import { PORT } from './helpers/request.js'
 
 
 before(function (done) {
 before(function (done) {
-  return app.listen(PORT, 'localhost', done)
+  return app.listen(PORT, '127.0.0.1', done)
 })
 })

+ 1 - 1
services/spelling/test/acceptance/js/helpers/request.js

@@ -3,7 +3,7 @@ import Request from 'request'
 
 
 export const PORT = 3005
 export const PORT = 3005
 
 
-const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:${PORT}`
+const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:${PORT}`
 
 
 const request = Request.defaults({
 const request = Request.defaults({
   baseUrl: BASE_URL,
   baseUrl: BASE_URL,

+ 1 - 1
services/spelling/test/stress/js/stressTest.js

@@ -87,7 +87,7 @@ const makeRequest = function (correctWords, incorrectWords, callback) {
     }
     }
   }
   }
   return request.post(
   return request.post(
-    'http://localhost:3005/user/1/check',
+    'http://127.0.0.1:3005/user/1/check',
     { json: true, body: { words: full } },
     { json: true, body: { words: full } },
     function (err, req, body) {
     function (err, req, body) {
       let m
       let m

+ 1 - 1
services/web/app.js

@@ -48,7 +48,7 @@ if (Settings.catchErrors) {
 FileWriter.ensureDumpFolderExists()
 FileWriter.ensureDumpFolderExists()
 
 
 const port = Settings.port || Settings.internal.web.port || 3000
 const port = Settings.port || Settings.internal.web.port || 3000
-const host = Settings.internal.web.host || 'localhost'
+const host = Settings.internal.web.host || '127.0.0.1'
 if (!module.parent) {
 if (!module.parent) {
   // Called directly
   // Called directly
 
 

+ 35 - 35
services/web/config/settings.defaults.js

@@ -174,7 +174,7 @@ module.exports = {
 
 
   redis: {
   redis: {
     web: {
     web: {
-      host: process.env.REDIS_HOST || 'localhost',
+      host: process.env.REDIS_HOST || '127.0.0.1',
       port: process.env.REDIS_PORT || '6379',
       port: process.env.REDIS_PORT || '6379',
       password: process.env.REDIS_PASSWORD || '',
       password: process.env.REDIS_PASSWORD || '',
       db: process.env.REDIS_DB,
       db: process.env.REDIS_DB,
@@ -185,36 +185,36 @@ module.exports = {
 
 
     // websessions:
     // websessions:
     // 	cluster: [
     // 	cluster: [
-    // 		{host: 'localhost', port: 7000}
-    // 		{host: 'localhost', port: 7001}
-    // 		{host: 'localhost', port: 7002}
-    // 		{host: 'localhost', port: 7003}
-    // 		{host: 'localhost', port: 7004}
-    // 		{host: 'localhost', port: 7005}
+    // 		{host: '127.0.0.1', port: 7000}
+    // 		{host: '127.0.0.1', port: 7001}
+    // 		{host: '127.0.0.1', port: 7002}
+    // 		{host: '127.0.0.1', port: 7003}
+    // 		{host: '127.0.0.1', port: 7004}
+    // 		{host: '127.0.0.1', port: 7005}
     // 	]
     // 	]
 
 
     // ratelimiter:
     // ratelimiter:
     // 	cluster: [
     // 	cluster: [
-    // 		{host: 'localhost', port: 7000}
-    // 		{host: 'localhost', port: 7001}
-    // 		{host: 'localhost', port: 7002}
-    // 		{host: 'localhost', port: 7003}
-    // 		{host: 'localhost', port: 7004}
-    // 		{host: 'localhost', port: 7005}
+    // 		{host: '127.0.0.1', port: 7000}
+    // 		{host: '127.0.0.1', port: 7001}
+    // 		{host: '127.0.0.1', port: 7002}
+    // 		{host: '127.0.0.1', port: 7003}
+    // 		{host: '127.0.0.1', port: 7004}
+    // 		{host: '127.0.0.1', port: 7005}
     // 	]
     // 	]
 
 
     // cooldown:
     // cooldown:
     // 	cluster: [
     // 	cluster: [
-    // 		{host: 'localhost', port: 7000}
-    // 		{host: 'localhost', port: 7001}
-    // 		{host: 'localhost', port: 7002}
-    // 		{host: 'localhost', port: 7003}
-    // 		{host: 'localhost', port: 7004}
-    // 		{host: 'localhost', port: 7005}
+    // 		{host: '127.0.0.1', port: 7000}
+    // 		{host: '127.0.0.1', port: 7001}
+    // 		{host: '127.0.0.1', port: 7002}
+    // 		{host: '127.0.0.1', port: 7003}
+    // 		{host: '127.0.0.1', port: 7004}
+    // 		{host: '127.0.0.1', port: 7005}
     // 	]
     // 	]
 
 
     api: {
     api: {
-      host: process.env.REDIS_HOST || 'localhost',
+      host: process.env.REDIS_HOST || '127.0.0.1',
       port: process.env.REDIS_PORT || '6379',
       port: process.env.REDIS_PORT || '6379',
       password: process.env.REDIS_PASSWORD || '',
       password: process.env.REDIS_PASSWORD || '',
       maxRetriesPerRequest: parseInt(
       maxRetriesPerRequest: parseInt(
@@ -232,7 +232,7 @@ module.exports = {
   internal: {
   internal: {
     web: {
     web: {
       port: process.env.WEB_PORT || 3000,
       port: process.env.WEB_PORT || 3000,
-      host: process.env.LISTEN_ADDRESS || 'localhost',
+      host: process.env.LISTEN_ADDRESS || '127.0.0.1',
     },
     },
   },
   },
 
 
@@ -242,7 +242,7 @@ module.exports = {
   apis: {
   apis: {
     web: {
     web: {
       url: `http://${
       url: `http://${
-        process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
+        process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
       }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
       }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
       user: httpAuthUser,
       user: httpAuthUser,
       pass: httpAuthPass,
       pass: httpAuthPass,
@@ -251,25 +251,25 @@ module.exports = {
       url: `http://${
       url: `http://${
         process.env.DOCUPDATER_HOST ||
         process.env.DOCUPDATER_HOST ||
         process.env.DOCUMENT_UPDATER_HOST ||
         process.env.DOCUMENT_UPDATER_HOST ||
-        'localhost'
+        '127.0.0.1'
       }:3003`,
       }:3003`,
     },
     },
     spelling: {
     spelling: {
-      url: `http://${process.env.SPELLING_HOST || 'localhost'}:3005`,
+      url: `http://${process.env.SPELLING_HOST || '127.0.0.1'}:3005`,
       host: process.env.SPELLING_HOST,
       host: process.env.SPELLING_HOST,
     },
     },
     docstore: {
     docstore: {
-      url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
-      pubUrl: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
+      url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
+      pubUrl: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
     },
     },
     chat: {
     chat: {
-      internal_url: `http://${process.env.CHAT_HOST || 'localhost'}:3010`,
+      internal_url: `http://${process.env.CHAT_HOST || '127.0.0.1'}:3010`,
     },
     },
     filestore: {
     filestore: {
-      url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
+      url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
     },
     },
     clsi: {
     clsi: {
-      url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
+      url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:3013`,
       // url: "http://#{process.env['CLSI_LB_HOST']}:3014"
       // url: "http://#{process.env['CLSI_LB_HOST']}:3014"
       backendGroupName: undefined,
       backendGroupName: undefined,
       submissionBackendClass:
       submissionBackendClass:
@@ -277,19 +277,19 @@ module.exports = {
     },
     },
     project_history: {
     project_history: {
       sendProjectStructureOps: true,
       sendProjectStructureOps: true,
-      url: `http://${process.env.PROJECT_HISTORY_HOST || 'localhost'}:3054`,
+      url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
     },
     },
     realTime: {
     realTime: {
-      url: `http://${process.env.REALTIME_HOST || 'localhost'}:3026`,
+      url: `http://${process.env.REALTIME_HOST || '127.0.0.1'}:3026`,
     },
     },
     contacts: {
     contacts: {
-      url: `http://${process.env.CONTACTS_HOST || 'localhost'}:3036`,
+      url: `http://${process.env.CONTACTS_HOST || '127.0.0.1'}:3036`,
     },
     },
     notifications: {
     notifications: {
-      url: `http://${process.env.NOTIFICATIONS_HOST || 'localhost'}:3042`,
+      url: `http://${process.env.NOTIFICATIONS_HOST || '127.0.0.1'}:3042`,
     },
     },
     webpack: {
     webpack: {
-      url: `http://${process.env.WEBPACK_HOST || 'localhost'}:3808`,
+      url: `http://${process.env.WEBPACK_HOST || '127.0.0.1'}:3808`,
     },
     },
     wiki: {
     wiki: {
       url: process.env.WIKI_URL || 'https://learn.sharelatex.com',
       url: process.env.WIKI_URL || 'https://learn.sharelatex.com',
@@ -328,7 +328,7 @@ module.exports = {
 
 
   // Where your instance of Overleaf Community Edition/Server Pro can be found publicly. Used in emails
   // Where your instance of Overleaf Community Edition/Server Pro can be found publicly. Used in emails
   // that are sent out, generated links, etc.
   // that are sent out, generated links, etc.
-  siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://localhost:3000'),
+  siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://127.0.0.1:3000'),
 
 
   lockManager: {
   lockManager: {
     lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),
     lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),

+ 2 - 2
services/web/docker-compose.common.env

@@ -6,7 +6,7 @@ QUEUES_REDIS_HOST=redis
 ANALYTICS_QUEUES_REDIS_HOST=redis
 ANALYTICS_QUEUES_REDIS_HOST=redis
 MONGO_URL=mongodb://mongo/test-overleaf
 MONGO_URL=mongodb://mongo/test-overleaf
 OVERLEAF_ALLOW_PUBLIC_ACCESS=true
 OVERLEAF_ALLOW_PUBLIC_ACCESS=true
-LINKED_URL_PROXY=http://localhost:6543
+LINKED_URL_PROXY=http://127.0.0.1:6543
 ENABLED_LINKED_FILE_TYPES=url,project_file,project_output_file,mendeley,zotero
 ENABLED_LINKED_FILE_TYPES=url,project_file,project_output_file,mendeley,zotero
 NODE_ENV=test
 NODE_ENV=test
 NODE_OPTIONS=--unhandled-rejections=strict
 NODE_OPTIONS=--unhandled-rejections=strict
@@ -17,7 +17,7 @@ PUBLIC_URL=http://www.overleaf.test:23000
 HTTP_TEST_HOST=www.overleaf.test
 HTTP_TEST_HOST=www.overleaf.test
 OT_JWT_AUTH_KEY="very secret key"
 OT_JWT_AUTH_KEY="very secret key"
 EXTERNAL_AUTH=none
 EXTERNAL_AUTH=none
-RECAPTCHA_ENDPOINT=http://localhost:2222/recaptcha/api/siteverify
+RECAPTCHA_ENDPOINT=http://127.0.0.1:2222/recaptcha/api/siteverify
 # Server-Pro LDAP
 # Server-Pro LDAP
 OVERLEAF_LDAP_URL=ldap://ldap:389
 OVERLEAF_LDAP_URL=ldap://ldap:389
 OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com
 OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com

+ 2 - 2
services/web/local-test.env

@@ -14,5 +14,5 @@ OVERLEAF_SAML_ENTRYPOINT=http://127.0.0.1:22280/simplesaml/saml2/idp/SSOService.
 OVERLEAF_SAML_CALLBACK_URL=http://127.0.0.1:22280/saml/callback
 OVERLEAF_SAML_CALLBACK_URL=http://127.0.0.1:22280/saml/callback
 
 
 COOKIE_DOMAIN=
 COOKIE_DOMAIN=
-PUBLIC_URL=http://localhost:23000
-HTTP_TEST_HOST=localhost
+PUBLIC_URL=http://127.0.0.1:23000
+HTTP_TEST_HOST=127.0.0.1

+ 1 - 1
services/web/modules/server-ce-scripts/test/acceptance/src/ServerCEScriptsTests.js

@@ -34,7 +34,7 @@ describe('ServerCEScripts', function () {
       try {
       try {
         run(
         run(
           'MONGO_SERVER_SELECTION_TIMEOUT=1' +
           'MONGO_SERVER_SELECTION_TIMEOUT=1' +
-            'MONGO_CONNECTION_STRING=mongodb://localhost:4242 ' +
+            'MONGO_CONNECTION_STRING=mongodb://127.0.0.1:4242 ' +
             'node modules/server-ce-scripts/scripts/check-mongodb'
             'node modules/server-ce-scripts/scripts/check-mongodb'
         )
         )
       } catch (e) {
       } catch (e) {

+ 17 - 17
services/web/test/acceptance/config/settings.test.defaults.js

@@ -41,58 +41,58 @@ module.exports = {
     },
     },
 
 
     web: {
     web: {
-      url: 'http://localhost:23000',
+      url: 'http://127.0.0.1:23000',
       user: httpAuthUser,
       user: httpAuthUser,
       pass: httpAuthPass,
       pass: httpAuthPass,
     },
     },
 
 
     haveIBeenPwned: {
     haveIBeenPwned: {
       enabled: false,
       enabled: false,
-      url: 'http://localhost:1337',
+      url: 'http://127.0.0.1:1337',
     },
     },
     documentupdater: {
     documentupdater: {
-      url: 'http://localhost:23003',
+      url: 'http://127.0.0.1:23003',
     },
     },
     spelling: {
     spelling: {
-      url: 'http://localhost:23005',
-      host: 'localhost',
+      url: 'http://127.0.0.1:23005',
+      host: '127.0.0.1',
     },
     },
     docstore: {
     docstore: {
-      url: 'http://localhost:23016',
-      pubUrl: 'http://localhost:23016',
+      url: 'http://127.0.0.1:23016',
+      pubUrl: 'http://127.0.0.1:23016',
     },
     },
     chat: {
     chat: {
-      internal_url: 'http://localhost:23010',
+      internal_url: 'http://127.0.0.1:23010',
     },
     },
     filestore: {
     filestore: {
-      url: 'http://localhost:23009',
+      url: 'http://127.0.0.1:23009',
     },
     },
     clsi: {
     clsi: {
-      url: 'http://localhost:23013',
+      url: 'http://127.0.0.1:23013',
     },
     },
     realTime: {
     realTime: {
-      url: 'http://localhost:23026',
+      url: 'http://127.0.0.1:23026',
     },
     },
     contacts: {
     contacts: {
-      url: 'http://localhost:23036',
+      url: 'http://127.0.0.1:23036',
     },
     },
     notifications: {
     notifications: {
-      url: 'http://localhost:23042',
+      url: 'http://127.0.0.1:23042',
     },
     },
     project_history: {
     project_history: {
       sendProjectStructureOps: true,
       sendProjectStructureOps: true,
-      url: `http://localhost:23054`,
+      url: `http://127.0.0.1:23054`,
     },
     },
     v1_history: {
     v1_history: {
-      url: `http://localhost:23100/api`,
+      url: `http://127.0.0.1:23100/api`,
       user: 'overleaf',
       user: 'overleaf',
       pass: 'password',
       pass: 'password',
     },
     },
     webpack: {
     webpack: {
-      url: 'http://localhost:23808',
+      url: 'http://127.0.0.1:23808',
     },
     },
     gitBridge: {
     gitBridge: {
-      url: 'http://localhost:28000',
+      url: 'http://127.0.0.1:28000',
     },
     },
   },
   },
 
 

+ 5 - 5
services/web/test/acceptance/config/settings.test.saas.js

@@ -12,13 +12,13 @@ const overrides = {
 
 
   apis: {
   apis: {
     thirdPartyDataStore: {
     thirdPartyDataStore: {
-      url: `http://localhost:23002`,
+      url: `http://127.0.0.1:23002`,
     },
     },
     analytics: {
     analytics: {
-      url: `http://localhost:23050`,
+      url: `http://127.0.0.1:23050`,
     },
     },
     recurly: {
     recurly: {
-      url: 'http://localhost:26034',
+      url: 'http://127.0.0.1:26034',
       subdomain: 'test',
       subdomain: 'test',
       apiKey: 'private-nonsense',
       apiKey: 'private-nonsense',
       webhookUser: 'recurly',
       webhookUser: 'recurly',
@@ -31,7 +31,7 @@ const overrides = {
     },
     },
 
 
     v1: {
     v1: {
-      url: `http://localhost:25000`,
+      url: `http://127.0.0.1:25000`,
       user: 'overleaf',
       user: 'overleaf',
       pass: 'password',
       pass: 'password',
     },
     },
@@ -66,7 +66,7 @@ const overrides = {
 module.exports = baseApp.mergeWith(baseTest.mergeWith(overrides))
 module.exports = baseApp.mergeWith(baseTest.mergeWith(overrides))
 
 
 for (const redisKey of Object.keys(module.exports.redis)) {
 for (const redisKey of Object.keys(module.exports.redis)) {
-  module.exports.redis[redisKey].host = process.env.REDIS_HOST || 'localhost'
+  module.exports.redis[redisKey].host = process.env.REDIS_HOST || '127.0.0.1'
 }
 }
 
 
 module.exports.mergeWith = function (overrides) {
 module.exports.mergeWith = function (overrides) {

+ 1 - 1
services/web/test/acceptance/src/HttpPermissionsPolicyTests.js

@@ -2,7 +2,7 @@ const { expect } = require('chai')
 const fetch = require('node-fetch')
 const fetch = require('node-fetch')
 const Settings = require('@overleaf/settings')
 const Settings = require('@overleaf/settings')
 
 
-const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:23000`
+const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
 
 
 describe('HttpPermissionsPolicy', function () {
 describe('HttpPermissionsPolicy', function () {
   it('should have permissions-policy header on user-facing pages', async function () {
   it('should have permissions-policy header on user-facing pages', async function () {

+ 1 - 1
services/web/test/acceptance/src/LinkedFilesTests.js

@@ -370,7 +370,7 @@ describe('LinkedFiles', function () {
         json: {
         json: {
           provider: 'url',
           provider: 'url',
           data: {
           data: {
-            url: 'ftp://localhost',
+            url: 'ftp://127.0.0.1',
           },
           },
           parent_folder_id: projectOneRootFolderId,
           parent_folder_id: projectOneRootFolderId,
           name: 'url-test-file-5',
           name: 'url-test-file-5',

+ 1 - 1
services/web/test/acceptance/src/helpers/UserHelper.js

@@ -217,7 +217,7 @@ class UserHelper {
    * @returns {string} baseUrl
    * @returns {string} baseUrl
    */
    */
   static baseUrl() {
   static baseUrl() {
-    return `http://${process.env.HTTP_TEST_HOST || 'localhost'}:23000`
+    return `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
   }
   }
 
 
   /**
   /**

+ 1 - 1
services/web/test/acceptance/src/helpers/request.js

@@ -1,6 +1,6 @@
 // TODO: This file was created by bulk-decaffeinate.
 // TODO: This file was created by bulk-decaffeinate.
 // Sanity-check the conversion and remove this comment.
 // Sanity-check the conversion and remove this comment.
-const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:23000`
+const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
 const request = require('request').defaults({
 const request = require('request').defaults({
   baseUrl: BASE_URL,
   baseUrl: BASE_URL,
   followRedirect: false,
   followRedirect: false,

+ 1 - 1
services/web/test/acceptance/src/mocks/MockV1HistoryApi.js

@@ -70,7 +70,7 @@ class MockV1HistoryApi extends AbstractMockApi {
         this.requestedZipPacks++
         this.requestedZipPacks++
         this.events.emit('v1-history-pack-zip')
         this.events.emit('v1-history-pack-zip')
         res.json({
         res.json({
-          zipUrl: `http://localhost:23100/fake-zip-download/${req.params.project_id}/version/${req.params.version}`,
+          zipUrl: `http://127.0.0.1:23100/fake-zip-download/${req.params.project_id}/version/${req.params.version}`,
         })
         })
       }
       }
     )
     )

+ 1 - 1
services/web/test/frontend/bootstrap.js

@@ -129,7 +129,7 @@ const fetch = require('node-fetch')
 globalThis.fetch =
 globalThis.fetch =
   global.fetch =
   global.fetch =
   window.fetch =
   window.fetch =
-    (url, ...options) => fetch(new URL(url, 'http://localhost'), ...options)
+    (url, ...options) => fetch(new URL(url, 'http://127.0.0.1'), ...options)
 
 
 // ignore CSS files
 // ignore CSS files
 const { addHook } = require('pirates')
 const { addHook } = require('pirates')

+ 1 - 1
services/web/test/unit/src/Compile/CompileManagerTests.js

@@ -25,7 +25,7 @@ describe('CompileManager', function () {
           apis: {
           apis: {
             clsi: { submissionBackendClass: 'n2d' },
             clsi: { submissionBackendClass: 'n2d' },
           },
           },
-          redis: { web: { host: 'localhost', port: 42 } },
+          redis: { web: { host: '127.0.0.1', port: 42 } },
           rateLimit: { autoCompile: {} },
           rateLimit: { autoCompile: {} },
         }),
         }),
         '../../infrastructure/RedisWrapper': {
         '../../infrastructure/RedisWrapper': {

+ 3 - 3
services/web/test/unit/src/Exports/ExportsHandlerTests.js

@@ -503,7 +503,7 @@ describe('ExportsHandler', function () {
     beforeEach(function (done) {
     beforeEach(function (done) {
       this.settings.apis = {
       this.settings.apis = {
         v1: {
         v1: {
-          url: 'http://localhost:5000',
+          url: 'http://127.0.0.1:5000',
           user: 'overleaf',
           user: 'overleaf',
           pass: 'pass',
           pass: 'pass',
           timeout: 15000,
           timeout: 15000,
@@ -596,7 +596,7 @@ describe('ExportsHandler', function () {
     beforeEach(function (done) {
     beforeEach(function (done) {
       this.settings.apis = {
       this.settings.apis = {
         v1: {
         v1: {
-          url: 'http://localhost:5000',
+          url: 'http://127.0.0.1:5000',
           user: 'overleaf',
           user: 'overleaf',
           pass: 'pass',
           pass: 'pass',
           timeout: 15000,
           timeout: 15000,
@@ -648,7 +648,7 @@ describe('ExportsHandler', function () {
     beforeEach(function (done) {
     beforeEach(function (done) {
       this.settings.apis = {
       this.settings.apis = {
         v1: {
         v1: {
-          url: 'http://localhost:5000',
+          url: 'http://127.0.0.1:5000',
           user: 'overleaf',
           user: 'overleaf',
           pass: 'pass',
           pass: 'pass',
           timeout: 15000,
           timeout: 15000,

+ 1 - 1
services/web/test/unit/src/HelperFiles/UrlHelperTests.js

@@ -9,7 +9,7 @@ describe('UrlHelper', function () {
   beforeEach(function () {
   beforeEach(function () {
     this.settings = {
     this.settings = {
       apis: { linkedUrlProxy: { url: undefined } },
       apis: { linkedUrlProxy: { url: undefined } },
-      siteUrl: 'http://localhost:3000',
+      siteUrl: 'http://127.0.0.1:3000',
     }
     }
     this.UrlHelper = SandboxedModule.require(modulePath, {
     this.UrlHelper = SandboxedModule.require(modulePath, {
       requires: { '@overleaf/settings': this.settings },
       requires: { '@overleaf/settings': this.settings },

+ 1 - 1
services/web/test/unit/src/Templates/TemplatesManagerTests.js

@@ -101,7 +101,7 @@ describe('TemplatesManager', function () {
           path: {
           path: {
             dumpFolder: this.dumpFolder,
             dumpFolder: this.dumpFolder,
           },
           },
-          siteUrl: (this.siteUrl = 'http://localhost:3000'),
+          siteUrl: (this.siteUrl = 'http://127.0.0.1:3000'),
           apis: {
           apis: {
             v1: {
             v1: {
               url: (this.v1Url = 'http://overleaf.com'),
               url: (this.v1Url = 'http://overleaf.com'),

+ 1 - 1
services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js

@@ -16,7 +16,7 @@ const collaberatorRef = new ObjectId()
 const projectName = 'project_name_here'
 const projectName = 'project_name_here'
 
 
 const thirdPartyDataStoreApiUrl = 'http://third-party-json-store.herokuapp.com'
 const thirdPartyDataStoreApiUrl = 'http://third-party-json-store.herokuapp.com'
-const siteUrl = 'http://www.localhost:3000'
+const siteUrl = 'http://127.0.0.1:3000'
 const filestoreUrl = 'filestore.overleaf.com'
 const filestoreUrl = 'filestore.overleaf.com'
 
 
 describe('TpdsUpdateSender', function () {
 describe('TpdsUpdateSender', function () {