Coder Social home page Coder Social logo

Comments (7)

h2non avatar h2non commented on August 20, 2024

You can do it programatically. See an example here.

from toxy.

bw-theo-omtzigt avatar bw-theo-omtzigt commented on August 20, 2024

I was able to get the example to proxy httpbin.org. I am trying to proxy s3.amazonaws.com with this code:

var fs = require('fs')
var toxy = require('toxy')

var opts = {
ssl: {
key: fs.readFileSync('server.key', 'utf8'),
cert: fs.readFileSync('server.crt', 'utf8')
}
}

var proxy = toxy(opts)

// Forward to HTTPS server
proxy
.get('/*')
.option({ secure: false })
.host('s3.amazonaws.com')
.forward('https://s3.amazonaws.com')

proxy.listen(443)
console.log('HTTPS toxy-proxy listening on port: ', 443)

but then run into this problem (my .boto redirects to localhost and 443)
python s3-boto-test.py
Traceback (most recent call last):
File "s3-boto-test.py", line 7, in
b = conn.create_bucket(bucket_name)
File "/usr/local/lib/python2.7/site-packages/boto/s3/connection.py", line 612, in create_bucket
data=data)
File "/usr/local/lib/python2.7/site-packages/boto/s3/connection.py", line 664, in make_request
retry_handler=retry_handler
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 1071, in make_request
retry_handler=retry_handler)
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 913, in _mexe
self.is_secure)
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 705, in get_http_connection
return self.new_http_connection(host, port, is_secure)
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 747, in new_http_connection
connection = self.proxy_ssl(host, is_secure and 443 or 80)
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 792, in proxy_ssl
int(self.proxy_port)), timeout)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 61] Connection refused

I don't understand the option yet, so will permutate that in the mean time.

from toxy.

h2non avatar h2non commented on August 20, 2024

Seems like the server is replying with a Location header. I would recommend you to test it directly from another HTTP client (like your browser) in order to determine where is the origin of the issue.

from toxy.

h2non avatar h2non commented on August 20, 2024

Closing for now due to inactivity.

from toxy.

rorysavage77 avatar rorysavage77 commented on August 20, 2024

I am seeing this error too, don't close.

from toxy.

gdabli avatar gdabli commented on August 20, 2024

I am getting the same issue. I could not understand what you suggested above. can you please explain it.

from toxy.

SPSpwetter avatar SPSpwetter commented on August 20, 2024

@h2non is saying that you should see if the browser can connect to the server without toxy, as the server may be the problem, not toxy. In other words, eliminate other possible contributing factors.

from toxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.