Start Firefox with Command Line using Proxy

I'm testing a proxy. I would like to start a second instance of Firefox with command line arguments so that the session uses a HTTP Proxy. (The first instance of Firefox starts normally and runs without the proxy so I can bypass the proxy and directly contact the web).

Firefox has command line arguments, but they don't appear to include proxy information. But I'm not an expert on Firefox command line or other Firefox tricks.

Is it possible to run a second instance of Firefox from the command line with proxy information?

3 Answers

It appears Firefox does not allow me to start it from the command line with proxy information.

I ended up using Chrome instead. It allows me to start it with Proxy settings from the command line. See Proxy Chromium for Testing.

Try proxychains if you are using linux/unix. Configure it (I`m sure google should help you) and then launch like:

proxychains firefox

Sorry if I did not understand you right.

1

Consider a script which sets up firefox to run via SOCKS proxy. HTTP proxy should work just as well, you only need to set right preferences. The script takes two arguments and does the following:

  1. Creates a new firefox profile with given name
  2. Toggles socks proxy settings to use the given port, while ignoring other settings
  3. Runs firefox with the new profile
#!/bin/sh
set -e -x
PROFILENAME=$1; shift
SOCKSPORT=$1; shift
firefox -CreateProfile $PROFILENAME
cd $HOME/.mozilla/firefox/*$PROFILENAME
set_pref() { if grep -q "$1" prefs.js ; then sed -i "s@user_pref(\"$1\",\(.*\));@$2@g" prefs.js else echo "$2" >> prefs.js fi
}
set_pref_asis() { set_pref "$1" "user_pref(\"$1\",$2);"
}
set_pref_str() { set_pref "$1" "user_pref(\"$1\",\"$2\");"
}
set_pref_str "network.proxy.no_proxies_on" "localhost, 127.0.0.1"
set_pref_str "network.proxy.socks" "127.0.0.1"
set_pref_asis "network.proxy.socks_port" "$SOCKSPORT"
set_pref_asis "network.proxy.type" 1
exec firefox --profile `pwd` "$@"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like