Skip to content

Instantly share code, notes, and snippets.

Last active January 8, 2023 19:56
What would you like to do?
haproxy configuration for using with
# Change YOUR_TOKEN to your prerender token
# Change (server_name) to your website url
frontend my-frontend
mode http
bind :80
acl user-agent-bot hdr_sub(User-Agent) -i baiduspider twitterbot facebookexternalhit rogerbot linkedinbot embedly showyoubot outbrain pinterest slackbot vkShare W3C_Validator
acl url-asset path_end js css xml less png jpg jpeg gif pdf doc txt ico rss zip mp3 rar exe wmv doc avi ppt mpg mpeg tif wav mov psd ai xls mp4 m4a swf dat dmg iso flv m4v torrent ttf woff
acl url-escaped-fragment url_sub _escaped_fragment_
use_backend prerender if user-agent-bot !url-asset
use_backend prerender if url-escaped-fragment !url-asset
backend prerender
mode http
timeout server 20s
server prerender check ssl verify none
http-request set-header X-Prerender-Token YOUR_TOKEN
reqrep ^([^\ ]*)\ /(.*)$ \1\ /\2
Copy link

2023, I used a combination of these comments and got it working. Thank you community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment