You need to make specific network configuration:
System Preferences > Network > Location: > Edit Locations...
left down + button,
enter a new netowrk configuration name, for example
Office / Wi-Fi + proxy,
choose it and configure it with the proxy setting you need.
You will have to make 2 network configurations one to go through your proxy, and one without. Example:
Office / Ethernet + proxy,
Home / Wi-fi - proxy.
You will notice that you have a new menu entry:
and you will be able to choose the correct network configuration which fits your actual network use.
To avoid most of the problems caused by the
Automatic predefined network configuration, I advise you to inactivate completly network interfaces you don't use. For example
Bluetooth doesn't have to be configured and open to network access if you don't use it yourself, and you don't control who uses it.