I'm required to speed up access to a specific website, which is terribly slow. I have no access to the source code/configuration of that server. After analysis, I figure out the problem:
- The server is far from customer's location, so latency is high - about 400ms
- The html pages have many
<script src="...">
tags, each of which require a separate request to load. - The browser only send 6-8 requests at a time, thus it would take at least 5s to fetch all the js files for one page
Caching of the js files is not viable because js file name and content are dynamically generated by the server.
So I'm trying to set up a (reverse?) proxy server with low latency connection to the original server. When customer request a .html file, the proxy server should get the file from original server, parse it, find all <script src="...">
, fetch the javascript, and embed the javascript code into <script>
tag (and removing src="...") then return the bundled html. This way the browser doesn't need to send additional requests to get js files, and the latency doesn't accumulate
The question(s):
- Is there a proxy server software with that feature available? Or maybe a nginx module/script?
- If customer's browser support HTTP/2, will a HTTP/2 proxy server solve the issue?
- Do you have any other solution to this problem?
Please help, thanks.