Linux Http Proxy Server

L

Tinyproxy

Tinyproxy

Tinyproxy is a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems. Designed from the ground up to be fast and yet small, it is an ideal solution for use cases such as embedded deployments where a full featured HTTP proxy is required, but the system resources for a larger proxy are unavailable.
Tinyproxy is distributed using the GNU GPL license (version 2 or above).
Features
Tinyproxy has a small footprint and requires very little in the way of system resources. The memory footprint tends to be around 2 MB with glibc, and the CPU load increases linearly with the number of simultaneous connections (depending on the speed of the connection). Thus, Tinyproxy can be run on an older machine, or on a network appliance such as a Linux-based broadband router, without any noticeable impact on performance.
Tinyproxy requires only a minimal POSIX environment to build and operate. It can use additional libraries to add functionality though.
Tinyproxy allows forwarding of HTTPS connections without modifying traffic in any way through the CONNECT method (see the ConnectPort directive).
Tinyproxy supports being configured as a transparent proxy, so that a proxy can be used without requiring any client-side configuration. You can also use it as a reverse proxy front-end to your websites.
Using the AddHeader directive, you can add/insert HTTP headers to outgoing traffic.
If you’re looking to build a custom web proxy, Tinyproxy is easy to modify to your custom needs. The source is straightforward, adhering to the KISS principle. As such, it can be used as a foundation for anything you may need a web proxy to do.
Tinyproxy has privacy features which can let you configure which HTTP headers should be allowed through, and which should be blocked. This allows you to restrict both what data comes to your web browser from the HTTP server (e. g., cookies), and to restrict what data is allowed through from your web browser to the HTTP server (e. g., version information).
Using the remote monitoring facility, you can access proxy statistics from afar, letting you know exactly how busy the proxy is.
You can configure Tinyproxy to control access by only allowing requests from a certain subnet, or from a certain interface, thus ensuring that random, unauthorized people will not be using your proxy.
With a bit of configuration (specifically, making Tinyproxy created files owned by a non-root user and running it on a port greater than 1024), Tinyproxy can be made to run without any special privileges, thus minimizing the chance of system compromise. Furthermore, it was designed with an eye towards preventing buffer overflows. The simplicity of the code ensures it remains easy to spot such bugs.
Downloads
On Red Hat Enterprise Linux, or its derivatives such as CentOS, install Tinyproxy from the EPEL repository by running yum install tinyproxy.
On Fedora, install Tinyproxy by running yum install tinyproxy.
On Debian and derived distributions, run apt-get install tinyproxy to install Tinyproxy.
For openSUSE run: zypper in tinyproxy
Arch users can install the Tinyproxy package from the community repository. Run pacman -S tinyproxy to install it.
FreeBSD, OpenBSD or NetBSD users can use the pkg_add utility to install the tinyproxy package.
Mac OS X users can check MacPorts to see if the Tinyproxy port there is recent enough.
If you feel that the Tinyproxy binary package in your operating system is not recent, please contact the package maintainer for that particular operating system. If this fails, you can always compile the latest stable version from source code.
We distribute Tinyproxy in source code form, and it has to be compiled in order to be used on your system. Please see the INSTALL file in the source code tree for build instructions. The current stable version of Tinyproxy is available on the releases page. The Tinyproxy NEWS file contains the release notes. You can verify the tarball using its PGP signature. You can also browse the older releases of Tinyproxy.
We use Git as the version control system for the Tinyproxy source code repository. To get a copy of the Tinyproxy repository, use the command:
git clone
Documentation
NAME
– Tinyproxy HTTP proxy daemon configuration file
SYNOPSIS
DESCRIPTION
tinyproxy(8) reads its configuration file, typically stored in `/etc/tinyproxy/` (or passed to Tinyproxy with -c on the command line). This manpage describes the syntax and contents of the configuration file.
The Tinyproxy configuration file contains key-value pairs, one per line. Lines starting with `#` and empty lines are comments and are ignored. Keywords are case-insensitive, whereas values are case-sensitive. Values may be enclosed in double-quotes (“) if they contain spaces.
The possible keywords and their descriptions are as follows:
User
The user which the Tinyproxy process should run as, after the initial port-binding has been done as the `root` user. Either the user name or the UID may be specified.
Group
The group which the Tinyproxy process should run as, after the initial port-binding has been done as the `root` user. Either the group name or the GID may be specified.
Port
The port which the Tinyproxy service will listen on. If the port is less than 1024, you will need to start the Tinyproxy process as the `root` user.
Listen
By default, Tinyproxy listens for connections on all available interfaces (i. e. it listens on the wildcard address `0. 0. 0`). With this configuration parameter, Tinyproxy can be told to listen only on one specific address.
Bind
This allows you to specify which address Tinyproxy will bind to for outgoing connections to web servers or upstream proxies. This parameter may be specified multiple times, then Tinyproxy will try all the specified addresses in order.
BindSame
If this boolean parameter is set to `yes`, then Tinyproxy will bind the outgoing connection to the IP address of the incoming connection that triggered the outgoing request.
Timeout
The maximum number of seconds of inactivity a connection is allowed to have before it is closed by Tinyproxy.
ErrorFile
This parameter controls which HTML file Tinyproxy returns when a given HTTP error occurs. It takes two arguments, the error number and the location of the HTML error file.
DefaultErrorFile
This parameter controls the HTML template file returned when an error occurs for which no specific error file has been set.
StatHost
This configures the host name or IP address that is treated as the `stat host`: Whenever a request for this host is received, Tinyproxy will return an internal statistics page instead of forwarding the request to that host. The template for this page can be configured with the `StatFile` configuration option. The default value of `StatHost` is “.
StatFile
This configures the HTML file that Tinyproxy sends when a request for the stathost is received. If this parameter is not set, Tinyproxy returns a hard-coded basic statistics page. See the STATHOST section in the tinyproxy(8) manual page for details.
Note that the StatFile and the error files configured with ErrorFile and DefaultErrorFile are template files that can contain a few template variables that Tinyproxy expands prior to delivery. Examples are “{cause}” for an abbreviated error description and “{detail}” for a detailed error message. The tinyproxy(8) manual page contains a description of all template variables.
LogFile
This controls the location of the file to which Tinyproxy writes its debug output. Alternatively, Tinyproxy can log to syslog — see the Syslog option.
Syslog
When set to `On`, this option tells Tinyproxy to write its debug messages to syslog instead of to a log file configured with `LogFile`. These two options are mutually exclusive.
LogLevel
Sets the log level. Messages from the set level and above are logged. For example, if the LogLevel was set to Warning, then all log messages from Warning to Critical would be output, but Notice and below would be suppressed. Allowed values are:
Critical (least verbose)
Error
Warning
Notice
Connect (log connections without Info’s noise)
Info (most verbose)
PidFile
This option controls the location of the file where the main Tinyproxy process stores its process ID for signaling purposes.
XTinyproxy
Setting this option to `Yes` tells Tinyproxy to add a header `X-Tinyproxy` containing the client’s IP address to the request.
Upstream
This option allows you to set up a set of rules for deciding whether an upstream proxy server is to be used, based on the host or domain of the site being accessed. The rules are stored in the order encountered in the configuration file and the LAST matching rule wins. The following forms for specifying upstream rules exist:
upstream type host:port turns proxy upstream support on generally.
upstream type user:[email protected]:port does the same, but uses the supplied credentials for authentication.
upstream type host:port “site_spec” turns on the upstream proxy for the sites matching `site_spec`.
`type` can be one of “, `socks4`, `socks5`, `none`.
upstream none “site_spec” turns off upstream support for sites matching `site_spec`, that means the connection is done directly.
The site can be specified in various forms as a hostname, domain name or as an IP range:
name matches host exactly
matches any host in domain “name”. matches any host with no domain (in ’empty’ domain)
IP/bits matches network/mask
IP/mask matches network/mask
Note that the upstream directive can also be used to null-route a specific target domain/host, e. g. : `upstream 0. 0:0 “. “`
MaxClients
Tinyproxy creates one thread for each connected client. This options specifies the absolute highest number processes that will be created. With other words, only MaxClients clients can be connected to Tinyproxy simultaneously.
Allow
Deny
The `Allow` and `Deny` options provide a means to customize which clients are allowed to access Tinyproxy. `Allow` and `Deny` lines can be specified multiple times to build the access control list for Tinyproxy. The order in the config file is important. If there are no `Allow` or `Deny` lines, then all clients are allowed. Otherwise, the default action is to deny access. The argument to `Allow` or `Deny` can be a single IP address of a client host, like `127. 1`, an IP address range, like `192. 168. 1/24` or a string that will be matched against the end of the client host name, i. e, this can be a full host name like “ or a domain name like `. ` or even a top level domain name like “. Note that by adding a rule using a host or domain name, a costly name lookup has to be done for every new connection, which could slow down the service considerably.
BasicAuth
Configure HTTP “Basic Authentication” username and password for accessing the proxy. If there are any entries specified, access is only granted for authenticated users.
BasicAuth user password
Configure one or more HTTP request headers to be added to outgoing HTTP requests that Tinyproxy makes. Note that this option will not work for HTTPS traffic, as Tinyproxy has no control over what headers are exchanged.
AddHeader “X-My-Header” “Powered by Tinyproxy”
ViaProxyName
RFC 2616 requires proxies to add a `Via` header to the HTTP requests, but using the real host name can be a security concern. If the `ViaProxyname` option is present, then its string value will be used as the host name in the Via header. Otherwise, the server’s host name will be used.
When this is set to yes, Tinyproxy does NOT add the `Via` header to the requests. This virtually puts Tinyproxy into stealth mode. Note that RFC 2616 requires proxies to set the `Via` header, so by enabling this option, you break compliance. Don’t disable the `Via` header unless you know what you are doing…
Filter
Tinyproxy supports filtering of web sites based on URLs or domains. This option specifies the location of the file containing the filter rules, one rule per line.
Rules are specified as POSIX basic regular expressions (BRE), unless FilterExtended is activated. Comment lines start with a `#` character.
Example filter file contents:
# filter exactly
^cnn\$
# filter all subdomains of, but not itself. *\$
# filter any domain that has in it, like
cnn\
# filter any domain that ends in
cnn\$
# filter any domain that starts with adserver
^adserver
FilterURLs
If this boolean option is set to `Yes` or `On`, filtering is performed for URLs rather than for domains. The default is to filter based on domains.
Note that filtering for URLs works only in plain HTTP scenarios. Since HTTPS has become ubiquitous during the last years, this will only work on a tiny fraction of websites, so it is recommended not to use this option.
FilterExtended
If this boolean option is set to `Yes`, then extended POSIX regular expressions are used for matching the filter rules. The default is to use basic POSIX regular expressions.
FilterCaseSensitive
If this boolean option is set to `Yes`, then the filter rules are matched in a case sensitive manner. The default is to match case-insensitively.
FilterDefaultDeny
The default filtering policy is to allow everything that is not matched by a filtering rule. Setting `FilterDefaultDeny` to `Yes` changes the policy do deny everything but the domains or URLs matched by the filtering rules.
Anonymous
If an `Anonymous` keyword is present, then anonymous proxying is enabled. The headers listed with `Anonymous` are allowed through, while all others are denied. If no Anonymous keyword is present, then all headers are allowed through. You must include quotes around the headers.
Most sites require cookies to be enabled for them to work correctly, so you will need to allow cookies through if you access those sites.
Example:
Anonymous “Host”
Anonymous “Authorization”
Anonymous “Cookie”
ConnectPort
This option can be used to specify the ports allowed for the CONNECT method. If no `ConnectPort` line is found, then all ports are allowed. To disable CONNECT altogether, include a single ConnectPort line with a value of `0`.
ReversePath
Configure one or more ReversePath directives to enable reverse proxy support. With reverse proxying it’s possible to make a number of sites appear as if they were part of a single site.
If you uncomment the following two directives and run Tinyproxy on your own computer at port 8888, you can access, using localhost:8888/example/.
ReversePath “/example/” ”
ReverseOnly
When using Tinyproxy as a reverse proxy, it is STRONGLY recommended that the normal proxy is turned off by setting this boolean option to `Yes`.
ReverseMagic
Setting this option to `Yes`, makes Tinyproxy use a cookie to track reverse proxy mappings. If you need to reverse proxy sites which have absolute links you must use this option.
ReverseBaseURL
The URL that is used to access this reverse proxy. The URL is used to rewrite HTTP redirects so that they won’t escape the proxy. If you have a chain of reverse proxies, you’ll need to put the outermost URL here (the address which the end user types into his/her browser). If this option is not set then no rewriting of redirects occurs.
Support
Feel free to report a new bug or suggest features via github issues.
Tinyproxy developers hang out in #tinyproxy on
Proxy Servers - Squid | Ubuntu

Proxy Servers – Squid | Ubuntu

Squid is a full-featured web proxy cache server application which provides proxy and cache services for Hyper Text Transport Protocol (HTTP), File Transfer Protocol (FTP), and other popular network protocols. Squid can implement caching and proxying of Secure Sockets Layer (SSL) requests and caching of Domain Name Server (DNS) lookups, and perform transparent caching. Squid also supports a wide variety of caching protocols, such as Internet Cache Protocol (ICP), the Hyper Text Caching Protocol (HTCP), the Cache Array Routing Protocol (CARP), and the Web Cache Coordination Protocol (WCCP).
The Squid proxy cache server is an excellent solution to a variety of proxy and caching server needs, and scales from the branch office to enterprise level networks while providing extensive, granular access control mechanisms, and monitoring of critical parameters via the Simple Network Management Protocol (SNMP). When selecting a computer system for use as a dedicated Squid caching proxy server for many users ensure it is configured with a large amount of physical memory as Squid maintains an in-memory cache for increased performance.
Installation
At a terminal prompt, enter the following command to install the Squid server:
sudo apt install squid
Configuration
Squid is configured by editing the directives contained within the /etc/squid/ configuration file. The following examples illustrate some of the directives which may be modified to affect the behavior of the Squid server. For more in-depth configuration of Squid, see the References section.
Tip
Prior to editing the configuration file, you should make a copy of the original file and protect it from writing so you will have the original settings as a reference, and to re-use as necessary. Make this copy and protect it from writing using the following commands:
sudo cp /etc/squid/ /etc/squid/
sudo chmod a-w /etc/squid/
To set your Squid server to listen on TCP port 8888 instead of the default TCP port 3128, change the _port directive as such:
_port 8888
Change the visible_hostname directive in order to give the Squid server a specific hostname. This hostname does not necessarily need to be the computer’s hostname. In this example it is set to weezie
visible_hostname weezie
The cache_dir option allows one to configure an on-disk cache, the default option is on-memory cache. The cache_dir directive takes the following arguments:
cache_dir [options]
In the config file you can find the default cache_dir directive commented out:
# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256
You can just use the default option but you can also customize your cache directory, basically changing the of this directory, it can be:
ufs: the old well-known Squid storage format that has always been there.
aufs: uses the same storage format as ufs, utilizing POSIX-threads to avoid blocking the main Squid process on disk-I/O. This was formerly known in Squid as async-io.
diskd: uses the same storage format as ufs, utilizing a separate process to avoid blocking the main Squid process on disk-I/O.
rock: is a database-style storage. All cached entries are stored in a “database” file, using fixed-size slots. A single entry occupies one or more slots.
If you want to use a different directory type please take a look at their different options.
Using Squid’s access control, you may configure use of Internet services proxied by Squid to be available only users with certain Internet Protocol (IP) addresses. For example, we will illustrate access by users of the 192. 168. 42. 0/24 subnetwork only:
Add the following to the bottom of the ACL section of your /etc/squid/ file:
acl fortytwo_network src 192. 0/24
Then, add the following to the top of the _access section of your /etc/squid/ file:
_access allow fortytwo_network
Using the excellent access control features of Squid, you may configure use of Internet services proxied by Squid to be available only during normal business hours. For example, we’ll illustrate access by employees of a business which is operating between 9:00AM and 5:00PM, Monday through Friday, and which uses the 10. 1. 0/24 subnetwork:
acl biz_network src 10. 0/24
acl biz_hours time M T W T F 9:00-17:00
_access allow biz_network biz_hours
Note
After making changes to the /etc/squid/ file, save the file and restart the squid server application to effect the changes using the following command entered at a terminal prompt:
sudo systemctl restart rvice
If formerly a customized squid3 was used that set up the spool at /var/log/squid3 to be a mountpoint, but otherwise kept the default configuration the upgrade will fail. The upgrade tries to rename/move files as needed, but it can’t do so for an active mountpoint. In that case please either adapt the mountpoint or the config in /etc/squid/ so that they match.
The same applies if the include config statement was used to pull in more files from the old path at /etc/squid3/. In those cases you should move and adapt your configuration accordingly.
References
Squid Website
Ubuntu Wiki Squid page.
How To Use Proxy Server To Access Internet at Shell Prompt ...

How To Use Proxy Server To Access Internet at Shell Prompt …

I‘m behind a squid proxy server. How do I access internet via proxy server when I use wget, lynx and other utilities from a shell prompt on a Linux or Unix-like systems?
Linux and UNIX-like systems has environment variable called _proxy. It allows you to connect text based session and/or applications via the proxy server. All you need is proxy server IP address (URL) and port values. This variable is almost used by all utilities such as elinks, lynx, wget, curl and others commands.
Tutorial details
Difficulty level Easy Root privileges No Requirements Linux/Unix shell promot Est. reading time 2 mintues
Set _proxy shell variable on Linux/OS X/Unix bash shell
Type the following command to set proxy server:
$ export _proxy=server-ip:port/
$ export _proxy=$ export _proxy=If the proxy server requires a username and password then add these to the URL. For example, to include the username foo and the password bar:
$ export _proxy=foo:[email protected]:port/
$ export _proxy=foo:[email protected] 0. 1:3128/
$ export _proxy=
How do I setup proxy variable for all users?
To setup the proxy environment variable as a global variable, open /etc/profile file:
# vi /etc/profile
Add the following information:
export _proxy=OR
export _proxy=
Save and close the file.
Patreon supporters only guides
A note about enabling proxy access to a specific user
To enable proxy access for a specific user, add the lines user shell profile. For the default bash shell, the profile is the file. bash_profile. For example, enable proxy access for a specifc user called vivek, type:
$ vi $HOME/. bash_profile
OR
# vi /home/vivek/. bash_profile
Append the following line:
How do I use password protected proxy server using various command line options?
You can simply use wget command as follows:
$ wget –proxy-user=USERNAME –proxy-password=PASSWORD Lynx command has the following syntax:
$ lynx -pauth=USER:PASSWORD Curl command has following syntax:
$ curl –proxy-user user:password
ADVERTISEMENT
CategoryList of Unix and Linux commandsDocumentationhelp • mandb • man • pinfoDisk space analyzersdf • duf • ncdu • pydfFile Managementcat • cp • less • mkdir • more • treeFirewallAlpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16. 04 • Ubuntu 18. 04 • Ubuntu 20. 04Linux Desktop AppsSkype • Spotify • VLC 3Modern utilitiesbat • exaNetwork UtilitiesNetHogs • dig • host • ip • nmapOpenVPNCentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18. 04Package Managerapk • aptProcesses Managementbg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtopSearchingag • grep • whereis • whichShell builtinscompgen • echo • printfText processingcut • revUser Informationgroups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • wWireGuard VPNAlpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20. 04

Frequently Asked Questions about linux http proxy server

About the author

proxyreview

If you 're a SEO / IM geek like us then you'll love our updates and our website. Follow us for the latest news in the world of web automation tools & proxy servers!

By proxyreview

Recent Posts

Useful Tools