User Tools

Site Tools


No ai soldati italiani all'estero




Rigacci.Org usa energia elettrica da fonti rinnovabili, grazie al gruppo di acquisto Merci Dolci.

Merci Dolci - Energia Rinnovabile

Software libero!

Petizione contro i brevetti software

Faunalia: Soluzioni GIS professionali



This is an old revision of the document!

Substitute HTML or JavaScript with a proxy

Using this recipe - while browsing a remote server - you can trick your browser into taking one file (JavaScript, HTML, image, ecc.) from a web server controlled by you instead of from the original server.

This can be useful to test some changes on a production server without actually touching the deployed code.

Create a file proxy.pac and store it into your web server:

function FindProxyForURL(url, host) {
    if (shExpMatch(url, "")) {
        return "PROXY";

Configure a fake VirtualHost on your web server:

NameVirtualHost *:8084
Listen 8084

<VirtualHost *:8084>
    DocumentRoot /var/www/
    ErrorLog /var/log/apache2/
    CustomLog /var/log/apache2/ combined

    # Force .jsp to be served as HTML
    AddType text/html .jsp

    <Directory /var/www/>
        AllowOverride All

Then put the fake file into the DocumentRoot for the VirtaulHost. In the example above it will be /var/www/

Configure the browser to use automatic proxy configuration, and give as the URL.

NOTE: This trick does not work with Internet Explorer, because it caches the proxy configuration on a per-server basis. If one page from the server was got via proxy, all the subsequent pages will be too.

doc/appunti/linux/sa/proxy_debug.1316101268.txt.gz · Last modified: 2011/09/15 17:41 (external edit)