Reputation: 357
I don't seem to understand something about proxying and JavaScript. I have searched several posts, but I am none the wiser...
I have a CentOS (6.4) server that functions as a proxy for another server (ARMv7). Both run Apache; the first one is version 2.2.15, the second one is version 2.2.22.
The proxy config on the first server is as follows:
ProxyPass /PV/ http://192.168.0.30/electricity/
When calling http://mysite.bla.xxx/PV/, I do get (part of) the index.html file served that is on the second server. However, the index.html file starts with this:
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="/javascript/jquery/jquery.js"></script>
<script type="text/javascript">
......
And here's where it goes wrong... When I examine the error-log on the proxyserver, I see:
File does not exist: /var/www/html/javascript, referer: http://mysite.bla.xxx/PV/
And of course, this file/directory does not exist.
I'm guessing that the second <script>
tag is the culprit, because it wants to find something at /javascript locally on the first server that doesn't exist.
Am I right? If so, how can I get Apache on the proxying server to serve the scripts included in index.html on the second server?
Upvotes: 4
Views: 3709
Reputation: 550
Drop the first slash from the js's URL.
Not <script src="/javascript/jquery/jquery.js">
but <script src="javascript/jquery/jquery.js">
Paths beginning with a slash will be assumed to reside in root. Thus your link points to http://mysite.bla.xxx/javascript/jquery/jquery.js
Upvotes: 1