Using a proxy
See original GitHub issueIt would be nice to have proxy support for Sequelize. Using Sequelize on a host with rotating IP addresses makes it near impossible to whitelist connections to an external database. I understand that this would depend on the connection package (node-mysql, pg). These packages do offer support for this feature, but there is no way to initialize Sequelize using those stream options. For example, with the pg package:
const pg = require('pg');
const SocksConnection = require('socksjs');
const pgServer = {
host: 'YOUR-HOST',
port: 5432
};
const proxyConnection = new SocksConnection(pgServer, {
user: process.env.PROXY_USER,
pass: process.env.PROXY_PASS,
host: process.env.PROXY_HOST,
port: process.env.PROXY_PORT,
});
const connectionConfig = {
user: 'YOUR-DB-USERNAME',
password: 'YOUR-DB-PASSWORD',
database: 'YOUR-DATABASE',
stream: proxyConnection,
ssl: true // Optional, depending on db config
};
const client = new pg.Client(connectionConfig);
// client.connect() { ... }
Since we can’t pass a custom pg instance into Sequelize, how would we go about making this work?
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
How to Set Up a Proxy Server on Your PC, Mac, or Web Browser
Open the IE toolbar and select Internet Options. · Open the Connections tab. · Select LAN Settings. · Check the “Use a proxy...
Read more >Proxy Server - What They Are & How to Use
Forward proxies are the most common type of proxy server. The work by taking a request and passing it through from an isolated,...
Read more >Connecting to a proxy server - IBM
Open Edge. · Click Settings and more > Advanced > Open proxy settings. · Under Manual proxy setup, select Use a proxy server....
Read more >What is a Proxy Server? How does it work? - Fortinet
A proxy server performs the function of a firewall and filter. The end-user or a network administrator can choose a proxy designed to...
Read more >What is a Proxy Server and How Does it Work? - Varonis
If you're using a proxy server, internet traffic flows through the proxy server on its way to the address you requested. The request...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
stream
option needs to be a function returning a new Socks connection, something like:Related: #9780