Skip to content

Instantly share code, notes, and snippets.

@Tofandel
Created March 26, 2020 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tofandel/1ce9635335c6969b5bc0289140b925cd to your computer and use it in GitHub Desktop.
Save Tofandel/1ce9635335c6969b5bc0289140b925cd to your computer and use it in GitHub Desktop.
Nginx config to add any html to any proxied server
DocumentRoot /your/document/root
ProxyRequests off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:6000/ retry=0
ProxyPassReverse / http://127.0.0.1:6000/
<Location "/">
AddOutputFilterByType SUBSTITUTE text/html
Substitute 's|</head>|<script src="my-customjs.js"></script></head>|i'
</Location>
RequestHeader set X_FORWARDED_PROTO 'https'
RequestHeader set X-Forwarded-Ssl on
RequestHeader set Accept-Encoding ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment