Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/derom/amp-cache-purge
Amp cache purging experiment - https://developers.google.com/amp/cache/update-cache
Based on https://amp.dev/documentation/guides-and-tutorials/learn/amp-caches-and-cors/amp-cache-urls/
PRIVATE_KEY_LOCATION
- default="private-key.pem". The private key from this repo is for tests.
PRIVATE_KEY_PASSWORD
- default=""
Here is an example http server. Purging requests are slow, so it's strongly recommended to use a queue(for example, rabbitmq) instead of direct http requests.
package main
import (
"net/http"
ampcachepurge "github.com/derom/amp-cache-purge"
)
func purgeHandler(w http.ResponseWriter, req *http.Request) {
url := req.FormValue("url")
httpClient := &http.Client{}
err := ampcachepurge.PurgeUrl(url, httpClient)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Write([]byte("success"))
}
func main() {
http.HandleFunc("/purge", purgeHandler)
http.ListenAndServe(":8090", nil)
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.