Sign inSign up

xenyo/spa-renderer

By xenyo

•Updated almost 3 years ago

Image
0

904

xenyo/spa-renderer repository overview

⁠SPA Renderer V2

⁠Description

Act as a web proxy server, render SPA website content and return the rendered html for better SEO or crawler. Also removed script tags in the html to prevent javascript running as the crawler does not need javascript in usual. It also detects User-Agent to decide whether render a desktop or a mobile view web page.

⁠2023-12-01
  • Updated to version 2. Added redis, api to invalid cache and cron to rebuild cache periodically.
⁠2023-01-26
  • Added window.renderReady, will wait until the variable to be true to capture the html.

⁠Usage

Run as Docker

docker run -it -d -p 8080:8080 -e PROXY_BASE=https://www.xenyo.com xenyo/spa-renderer

Change the PROXY_BASE env variable to your specific proxy target.

To return thr rendered html, just browse http://localhost:8080/⁠ The url path will pass to the target server as well.

⁠Environment Variables

VariableDescriptionDefault Value
PROXY_BASEProxy TargetNA
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATHChrome Execute Path/usr/bin/chromium-browser
LISTEN_PORTServer Listen Port8080
REBUILD_CRONCron express for rebuild cache0 * * * *
REDIS_PORTRedis connection port6379
REDIS_HOSTRedis connection hostlocalhost

⁠API

API Base: /api/cache

PathMethodDefault Description
/flushPostFlush all cache, include url list
/rmPostRemove all cache, except url list
/rebuildPostRebuild cache from the url list

⁠Development

yarn
yarn dev

Tag summary

Content type

Image

Digest

sha256:e1344f071…

Size

292.5 MB

Last updated

almost 3 years ago

docker pull xenyo/spa-renderer