mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-21 06:34:58 +01:00
Set cache-control headers for static routes (getinfor and home)
This tells clients to cache the response for a few minutes and thus makes it easier to run lndhub behind a proxy to cache static response
This commit is contained in:
@@ -95,5 +95,7 @@ func (controller *GetInfoController) GetInfo(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
// BlueWallet right now requires a `identity_pubkey` in the response
|
// BlueWallet right now requires a `identity_pubkey` in the response
|
||||||
// https://github.com/BlueWallet/BlueWallet/blob/a28a2b96bce0bff6d1a24a951b59dc972369e490/class/wallets/lightning-custodian-wallet.js#L578
|
// https://github.com/BlueWallet/BlueWallet/blob/a28a2b96bce0bff6d1a24a951b59dc972369e490/class/wallets/lightning-custodian-wallet.js#L578
|
||||||
|
|
||||||
|
c.Response().Header().Set(echo.HeaderCacheControl, "public, max-age=300, stale-if-error=21600") // cache for 5 minutes or if error for 6 hours max
|
||||||
return c.JSON(http.StatusOK, info)
|
return c.JSON(http.StatusOK, info)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ func (controller *HomeController) Home(c echo.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
c.Response().Header().Set(echo.HeaderCacheControl, "public, max-age=300, stale-if-error=21600") // cache for 5 minutes or if error for 6 hours max
|
||||||
return c.HTMLBlob(http.StatusOK, buf.Bytes())
|
return c.HTMLBlob(http.StatusOK, buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user