diff --git a/js/src/main/scala/cs214/webapp/client/Pages.scala b/js/src/main/scala/cs214/webapp/client/Pages.scala
index 2ef7aa1e5f9a94d2da50c7fe12f0042f22963fef..5f3a02902ebdbaffaf2addd31d3665ba19d834ea 100644
--- a/js/src/main/scala/cs214/webapp/client/Pages.scala
+++ b/js/src/main/scala/cs214/webapp/client/Pages.scala
@@ -269,11 +269,18 @@ case class AppPage(appId: AppId, uiId: UIId, instanceId: InstanceId, userId: Use
       val port = dom.window.location.port
       val hostName = dom.window.location.hostname
       val protocol = if dom.window.location.protocol.startsWith("https") then "wss" else "ws"
+      val hypertextProtocol = dom.window.location.protocol.replace(":","")
       val endpoint = appInfo.wsEndpoint
         .replace("{{protocol}}", protocol)
         .replace("{{hostName}}", hostName + (if port.nonEmpty then f":$port" else ""))
         .replace("{{userId}}", URLEncoder.encode(userId, "UTF-8"))
-      IpBanner(appInfo.shareUrl).renderInto(target.querySelector("#banner"))
+      val shareUrlHost = 
+        if hostName == "localhost" then appInfo.hostAddress else hostName
+      println("my hostname is " + hostName)
+
+      val shareUrl = f"$hypertextProtocol://${shareUrlHost}${if port.nonEmpty then f":$port" else ""}${appInfo.shareSubUrl}"
+          
+      IpBanner(shareUrl).renderInto(target.querySelector("#banner"))
       app.init(instanceId, userId, endpoint, target.querySelector("#app"))
 
 /** The top-most share banner */
diff --git a/jvm/src/main/scala/cs214/webapp/server/web/WebServerRoutes.scala b/jvm/src/main/scala/cs214/webapp/server/web/WebServerRoutes.scala
index 092340dff76a61866587d67128a93943d05adf68..87b3da5de4815984454c89b11617e5fccd0c0bcf 100644
--- a/jvm/src/main/scala/cs214/webapp/server/web/WebServerRoutes.scala
+++ b/jvm/src/main/scala/cs214/webapp/server/web/WebServerRoutes.scala
@@ -49,12 +49,12 @@ private[server] final case class WebServerRoutes()(using cc: castor.Context, log
     ListAppsResponse.Wire.encode(ListAppsResponse(WebServer.appDirectory.values.map(_.appInfo).toSeq))
 
   @cask.getJson(f"${Endpoints.Api.instanceInfo}")
-  def getAppInfo(instanceId: InstanceId) =
+  def getAppInfo(request: cask.Request, instanceId: InstanceId) =
     val response: cask.Response[JsonData] = WebServer.instances.get(instanceId) match
       case Some(inst) =>
-        val shareUrl = f"http://$hostAddress:${Config.HTTP_PORT}${Endpoints.App}/${inst.appInfo.id}/$instanceId/"
+        val shareSubUrl = f"${Endpoints.App}/${inst.appInfo.id}/$instanceId/" //modif
         val wsEndpoint = f"{{protocol}}://{{hostName}}${Endpoints.WebSocket}/$instanceId/{{userId}}"
-        val response = InstanceInfoResponse(instanceId, inst.registeredUserIds, wsEndpoint, shareUrl)
+        val response = InstanceInfoResponse(instanceId, inst.registeredUserIds, wsEndpoint, shareSubUrl, hostAddress)
         InstanceInfoResponse.Wire.encode(response)
       case None =>
         cask.Response(f"Unknown instance id $instanceId", 400)
diff --git a/shared/src/main/scala/cs214/webapp/Messages.scala b/shared/src/main/scala/cs214/webapp/Messages.scala
index 7457ee2e395c31f8d79041bcab7394747501a7b2..fa9dae4443e7db30feaaa74d57d10ae4aed4661b 100644
--- a/shared/src/main/scala/cs214/webapp/Messages.scala
+++ b/shared/src/main/scala/cs214/webapp/Messages.scala
@@ -92,7 +92,7 @@ object CreateInstanceResponse:
       CreateInstanceResponse(js("instanceId").str)
 
 /** The response to an AppInfo query */
-case class InstanceInfoResponse(instanceId: InstanceId, userIds: Seq[UserId], wsEndpoint: String, shareUrl: String)
+case class InstanceInfoResponse(instanceId: InstanceId, userIds: Seq[UserId], wsEndpoint: String, shareSubUrl: String, hostAddress: String)
 
 object InstanceInfoResponse:
   val strsWire = SeqWire(StringWire)
@@ -102,12 +102,14 @@ object InstanceInfoResponse:
         "instanceId" -> t.instanceId,
         "userIds" -> strsWire.encode(t.userIds),
         "wsEndpoint" -> t.wsEndpoint,
-        "shareUrl" -> t.shareUrl
+        "shareSubUrl" -> t.shareSubUrl,
+        "hostAddress" -> t.hostAddress
       )
     def decode(js: ujson.Value): Try[InstanceInfoResponse] = Try:
       InstanceInfoResponse(
         js("instanceId").str,
         strsWire.decode(js("userIds")).get,
         js("wsEndpoint").str,
-        js("shareUrl").str
+        js("shareSubUrl").str,
+        js("hostAddress").str
       )