[](https://gitter.im/elazarl/goproxy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Package goproxy provides a customizable HTTP proxy library for Go (golang),
It supports regular HTTP proxy, HTTPS through CONNECT, and "hijacking" HTTPS
connection using "Man in the Middle" style attack.
The intent of the proxy, is to be usable with reasonable amount of traffic
yet, customizable and programable.
The proxy itself is simply a `net/http` handler.
In order to use goproxy, one should set their browser to use goproxy as an HTTP
proxy. Here is how you do that [in Chrome](https://support.google.com/chrome/answer/96815?hl=en)
and [in Firefox](http://www.wikihow.com/Enter-Proxy-Settings-in-Firefox).
For example, the URL you should use as proxy when running `./bin/basic` is
`localhost:8080`, as this is the default binding for the basic proxy.
## Mailing List
New features would be discussed on the [mailing list](https://groups.google.com/forum/#!forum/goproxy-dev)
before their development.
## Latest Stable Release
Get the latest goproxy from `gopkg.in/elazarl/goproxy.v1`.
# Why not Fiddler2?
Fiddler is an excellent software with similar intent. However, Fiddler is not
as customable as goproxy intend to be. The main difference is, Fiddler is not
intended to be used as a real proxy.
A possible use case that suits goproxy but
not Fiddler, is, gathering statisitics on page load times for a certain website over a week.
With goproxy you could ask all your users to set their proxy to a dedicated machine running a
goproxy server. Fiddler is a GUI app not designed to be ran like a server for multiple users.
# A taste of goproxy
To get a taste of `goproxy`, a basic HTTP/HTTPS transparent proxy
import (
"github.com/elazarl/goproxy"
"log"
"net/http"
)
func main() {
proxy := goproxy.NewProxyHttpServer()
proxy.Verbose = true
log.Fatal(http.ListenAndServe(":8080", proxy))
}
This line will add `X-GoProxy: yxorPoG-X` header to all requests sent through the proxy
2. Transparent proxy support for http/https including MITM certificate generation for TLS. See the [transparent example.](https://github.com/elazarl/goproxy/tree/master/examples/goproxy-transparent)
# License
I put the software temporarily under the Go-compatible BSD license,
if this prevents someone from using the software, do let mee know and I'll consider changing it.
At any rate, user feedback is very important for me, so I'll be delighted to know if you're using this package.
# Beta Software
I've received a positive feedback from a few people who use goproxy in production settings.
I believe it is good enough for usage.
I'll try to keep reasonable backwards compatability. In case of a major API change,
<h2><spanclass="jq-jquery"><span>jQuery</span></span> is a new kind of JavaScript Library.</h2>
<p>jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. <strong>jQuery is designed to change the way that you write JavaScript.</strong></p>
<pclass="neat"><strong>Congratulations!</strong> You just ran a snippet of jQuery code. Wasn't that easy? There's lots of example code throughout the <strong><ahref="http://docs.jquery.com/">documentation</a></strong> on this site. Be sure to give all the code a test run to see what happens.</p>
<ahref="http://link.packtpub.com/S3Fr9Q"class="jq-bookImg"><imgsrc="http://learningjquery.kswedberg.netdna-cdn.com/wp-content/themes/ljq/images/ljq3rded.jpg"alt="Learning jQuery Third Edition"width="55"height="70"/></a>
<h3><ahref="http://link.packtpub.com/S3Fr9Q">Learning jQuery Third Edition</a></h3>
<divclass="jq-author">Karl Swedberg and <br/>Jonathan Chaffer</div>
<ahref="http://www.packtpub.com/jquery-plugin-development-beginners-guide/book/mid/1911104odmdz"class="jq-bookImg"><imgsrc="http://static.jquery.com/books/jquery-plugin-developers-guide_thumb.jpg"alt="jQuery Plugin Development Beginner's Guide"width="55"height="70"/></a>
<h3><ahref="http://www.packtpub.com/jquery-plugin-development-beginners-guide/book/mid/1911104odmdz">jQuery Plugin Development Beginner's Guide</a></h3>
<ahref="http://www.manning.com/affiliate/idevaffiliate.php?id=648_176"class="jq-bookImg"><imgsrc="http://static.jquery.com/books/jquery-in-action-2ed_thumb.jpg"alt="jQuery in Action"width="55"height="70"/></a>
<h3><ahref="http://www.manning.com/affiliate/idevaffiliate.php?id=648_176">jQuery in Action</a></h3>
<pid="jq-hosting">Sponsored by <ahref="http://mediatemple.net"class="jq-mediaTemple">Media Temple</a> and <ahref="http://jquery.org/sponsors">others</a>.</p>
<ulclass="chunklist chunklist_set"><li><ahref="copyright.php">Copyright</a></li><li><ahref="manual.php">PHP Manual</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="preface.php">Preface</a></li></ul></li><li><ahref="getting-started.php">Getting Started</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="introduction.php">Introduction</a></li><li><ahref="tutorial.php">A simple tutorial</a></li></ul></li><li><ahref="install.php">Installation and Configuration</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="install.general.php">General Installation Considerations</a></li><li><ahref="install.unix.php">Installation on Unix systems</a></li><li><ahref="install.macosx.php">Installation on Mac OS X</a></li><li><ahref="install.windows.php">Installation on Windows systems</a></li><li><ahref="install.cloud.php">Installation on Cloud Computing platforms</a></li><li><ahref="install.fpm.php">FastCGI Process Manager (FPM)</a></li><li><ahref="install.pecl.php">Installation of PECL extensions</a></li><li><ahref="install.problems.php">Problems?</a></li><li><ahref="configuration.php">Runtime Configuration</a></li></ul></li><li><ahref="langref.php">Language Reference</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="language.basic-syntax.php">Basic syntax</a></li><li><ahref="language.types.php">Types</a></li><li><ahref="language.variables.php">Variables</a></li><li><ahref="language.constants.php">Constants</a></li><li><ahref="language.expressions.php">Expressions</a></li><li><ahref="language.operators.php">Operators</a></li><li><ahref="language.control-structures.php">Control Structures</a></li><li><ahref="language.functions.php">Functions</a></li><li><ahref="language.oop5.php">Classes and Objects</a></li><li><ahref="language.namespaces.php">Namespaces</a></li><li><ahref="language.exceptions.php">Exceptions</a></li><li><ahref="language.references.php">References Explained</a></li><li><ahref="reserved.variables.php">Predefined Variables</a></li><li><ahref="reserved.exceptions.php">Predefined Exceptions</a></li><li><ahref="reserved.interfaces.php">Predefined Interfaces</a></li><li><ahref="context.php">Context options and parameters</a></li><li><ahref="wrappers.php">Supported Protocols and Wrappers</a></li></ul></li><li><ahref="security.php">Security</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="security.intro.php">Introduction</a></li><li><ahref="security.general.php">General considerations</a></li><li><ahref="security.cgi-bin.php">Installed as CGI binary</a></li><li><ahref="security.apache.php">Installed as an Apache module</a></li><li><ahref="security.filesystem.php">Filesystem Security</a></li><li><ahref="security.database.php">Database Security</a></li><li><ahref="security.errors.php">Error Reporting</a></li><li><ahref="security.globals.php">Using Register Globals</a></li><li><ahref="security.variables.php">User Submitted Data</a></li><li><ahref="security.magicquotes.php">Magic Quotes</a></li><li><ahref="security.hiding.php">Hiding PHP</a></li><li><ahref="security.current.php">Keeping Current</a></li></ul></li><li><ahref="features.php">Features</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="features.http-auth.php">HTTP authentication with PHP</a></li><li><ahref="features.cookies.php">Cookies</a></li><li><ahref="features.sessions.php">Sessions</a></li><li><ahref="features.xforms.php">Dealing with XForms</a></li><li><ahref="features.file-upload.php">Handling file uploads</a></li><li><ahref="features.remote-files.php">Using remote files</a></li><li><ahref="features.connection-handling.php">Connection handling</a></li><li><ahref="features.persistent-connections.php">Persistent Database Connections</a></li><li><ahref="features.safe-mode.php">Safe Mode</a></li><li><ahref="features.commandline.php">Command line usage</a> — Using PHP from the command line</li><li><ahref="features.gc.php">Garbage Collection</a></li></ul></li><li><ahref="funcref.php">Function Reference</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="refs.basic.php.php">Affecting PHP's Behaviour</a></li><li><ahref="refs.utilspec.audio.php">Audio Formats Manipulation</a></li><li><ahref="refs.remote.auth.php">Authentication Services</a></li><li><ahref="refs.calendar.php">Date and Time Related Extensions</a></li><li><ahref="refs.utilspec.cmdline.php">Command Line Specific Extensions</a></li><li><ahref="refs.compression.php">Compression and Archive Extensions</a></li><li><ahref="refs.creditcard.php">Credit Card Processing</a></li><li><ahref="refs.crypto.php">Cryptography Extensions</a></li><li><ahref="refs.database.php">Database Extensions</a></li><li><ahref="refs.fileprocess.file.php">File System Related Extensions</a></li><li><ahref="refs.international.php">Human Language and Character Encoding Support</a></li><li><ahref="refs.utilspec.image.php">Image Processing and Generation</a></li><li><ahref="refs.remote.mail.php">Mail Related Extensions</a></li><li><ahref="refs.math.php">Mathematical Extensions</a></li><li><ahref="refs.utilspec.nontext.php">Non-Text MIME Output</a></li><li><ahref="refs.fileprocess.process.php">Process Control Extensions</a></li><li><ahref="refs.basic.other.php">Other Basic Extensions</a></li><li><ahref="refs.remote.other.php">Other Services</a></li><li><ahref="refs.search.php">Search Engine Extensions</a></li><li><ahref="refs.utilspec.server.php">Server Specific Extensions</a></li><li><ahref="refs.basic.session.php">Session Extensions</a></li><li><ahref="refs.basic.text.php">Text Processing</a></li><li><ahref="refs.basic.vartype.php">Variable and Type Related Extensions</a></li><li><ahref="refs.webservice.php">Web Services</a></li><li><ahref="refs.utilspec.windows.php">Windows Only Extensions</a></li><li><ahref="refs.xml.php">XML Manipulation</a></li></ul></li><li><ahref="internals2.php">PHP at the Core: A Hacker's Guide to the Zend Engine</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="internals2.preface.php">Preface</a></li><li><ahref="internals2.counter.php">The "counter" Extension - A Continuing Example</a></li><li><ahref="internals2.buildsys.php">The PHP 5 build system</a></li><li><ahref="internals2.structure.php">Extension structure</a></li><li><ahref="internals2.memory.php">Memory management</a></li><li><ahref="internals2.variables.php">Working with variables</a></li><li><ahref="internals2.funcs.php">Writing functions</a></li><li><ahref="internals2.objects.php">Working with classes and objects</a></li><li><ahref="internals2.resources.php">Working with resources</a></li><li><ahref="internals2.ini.php">Working with INI settings</a></li><li><ahref="internals2.streams.php">Working with streams</a></li><li><ahref="internals2.pdo.php">PDO Driver How-To</a></li><li><ahref="internals2.faq.php">Extension FAQs</a></li><li><ahref="internals2.apiref.php">Zend Engine 2 API reference</a></li><li><ahref="internals2.opcodes.php">Zend Engine 2 Opcodes</a></li><li><ahref="internals2.ze1.php">Zend Engine 1</a></li></ul></li><li><ahref="faq.php">FAQ</a> — FAQ: Frequently Asked Questions<ulclass="chunklist chunklist_set chunklist_children"><li><ahref="faq.general.php">General Information</a></li><li><ahref="faq.mailinglist.php">Mailing lists</a></li><li><ahref="faq.obtaining.php">Obtaining PHP</a></li><li><ahref="faq.databases.php">Database issues</a></li><li><ahref="faq.installation.php">Installation</a></li><li><ahref="faq.build.php">Build Problems</a></li><li><ahref="faq.using.php">Using PHP</a></li><li><ahref="faq.passwords.php">Password Hashing</a> — Safe Password Hashing</li><li><ahref="faq.html.php">PHP and HTML</a></li><li><ahref="faq.com.php">PHP and COM</a></li><li><ahref="faq.languages.php">PHP and other languages</a></li><li><ahref="faq.migration5.php">Migrating from PHP 4 to PHP 5</a></li><li><ahref="faq.misc.php">Miscellaneous Questions</a></li></ul></li><li><ahref="appendices.php">Appendices</a><ulclass="chunklist chunklist_set chunklist_children"><li><ahref="history.php">History of PHP and Related Projects</a></li><li><ahref="migration54.php">Migrating from PHP 5.3.x to PHP 5.4.x</a></li><li><ahref="migration53.php">Migrating from PHP 5.2.x to PHP 5.3.x</a></li><li><ahref="migration52.php">Migrating from PHP 5.1.x to PHP 5.2.x</a></li><li><ahref="migration51.php">Migrating from PHP 5.0.x to PHP 5.1.x</a></li><li><ahref="migration5.php">Migrating from PHP 4 to PHP 5.0.x</a></li><li><ahref="oop4.php">Classes and Objects (PHP 4)</a></li><li><ahref="debugger.php">Debugging in PHP</a></li><li><ahref="configure.php">Configure options</a></li><li><ahref="ini.php">php.ini directives</a></li><li><ahref="extensions.php">Extension List/Categorization</a></li><li><ahref="aliases.php">List of Function Aliases</a></li><li><ahref="reserved.php">List of Reserved Words</a></li><li><ahref="resource.php">List of Resource Types</a></li><li><ahref="filters.php">List of Available Filters</a></li><li><ahref="transports.php">List of Supported Socket Transports</a></li><li><ahref="types.comparisons.php">PHP type comparison tables</a></li><li><ahref="tokens.php">List of Parser Tokens</a></li><li><ahref="userlandnaming.php">Userland Naming Guide</a></li><li><ahref="about.php">About the manual</a></li><li><ahref="cc.license.php">Creative Commons Attribution 3.0</a></li><li><ahref="indexes.php">Index listing</a></li></ul></li></ul></div><br/><br/>
<divid="usernotes">
<divclass="head">
<spanclass="action"><ahref="/manual/add-note.php?sect=index&redirect=http://www.php.net/manual/en/index.php"><imgsrc="http://static.php.net/www.php.net/images/notes-add.gif"alt="add a note"width="13"height="13"class="middle"/></a><small><ahref="/manual/add-note.php?sect=index&redirect=http://www.php.net/manual/en/index.php">add a note</a></small></span>
<small>User Contributed Notes</small>
<strong>PHP Manual</strong>
</div>
<divclass="note">There are no user contributed notes for this page.</div></div><br/>
<metaname="Description"content="Free HTML XHTML CSS JavaScript jQuery XML DOM XSL XSLT RSS AJAX ASP .NET PHP SQL tutorials, references, examples for web building."/>
<liid="header_offline"onclick="changeHeader('offline','-312');selIcon='offline'"onmouseover="iconHover('offline','-312')"onmouseout="iconHoverOut('offline','-312')"title="HTML5 Local Storage"></li>
<listyle="width:105px;"id="header_form"onclick="changeHeader('form','-418');selIcon='form'"onmouseover="iconHover('form','-418')"onmouseout="iconHoverOut('form','-418')"title="HTML5 Semantics and Forms"></li>
<ahref="http://www.wix.com/html5/now-on-wix?utm_campaign=ma_w3schools.com&experiment_id=ma_html_w3schools.comlink2"rel="nofollow"target="_blank">CREATE HTML Websites</a>
</td></tr>
</table>
<table>
<tr><th>W3SCHOOLS EXAMS</th></tr>
<tr><td>
<atarget="_blank"href="/cert/default.asp">Get Certified in:<br/>HTML, CSS, JavaScript, XML, PHP, and ASP</a>
This transparent example in goproxy is meant to show how to transparenty proxy and hijack all http and https connections while doing a man-in-the-middle to the TLS session. It requires that goproxy sees all the packets traversing out to the internet. Linux iptables rules deal with changing the source/destination IPs to act transparently, but you do need to setup your network configuration so that goproxy is a mandatory stop on the outgoing route. Primarily you can do this by placing the proxy inline. goproxy does not have any WCCP support itself; patches welcome.
## Why not explicit?
Transparent proxies are more difficult to maintain and setup from a server side, but they require no configuration on the client(s) which could be in unmanaged systems or systems that don't support a proxy configuration. See the [eavesdropper example](https://github.com/elazarl/goproxy/blob/master/examples/goproxy-eavesdropper/main.go) if you want to see an explicit proxy example.
## Potential Issues
Support for very old clients using HTTPS will fail. Clients need to send the SNI value in the TLS ClientHello which most modern clients do these days, but old clients will break.
If you're routing table allows for it, an explicit http request to goproxy will cause it to fail in an endless loop since it will try to request resources from itself repeatedly. This could be solved in the goproxy code by looking up the hostnames, but it adds a delay that is much easier/faster to handle on the routing side.
## Routing Rules
Example routing rules are included in [proxy.sh](https://github.com/elazarl/goproxy/blob/master/examples/goproxy-transparent/proxy.sh) but are best when setup using your distribution's configuration.
<divid="header_eng"><spanclass="eng"><ahref="http://www-e.openu.ac.il/geninfor/shoham.html"target="_self"title="shoham english site">English</a></span></div>