EzDevInfo.com

proxy interview questions

Top proxy frequently asked interview questions

How do I set the proxy to be used by the JVM

Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema.

I am behind a proxy server. How do I set my JVM to use the proxy ?


Source: (StackOverflow)

Using pip behind a proxy

I'm trying to use pip behind a proxy at work. I'm not a networking expert so bear with me if this super obvious.

One of the answers from this post suggested using CNTLM. I installed and configured it per this other post, but running cntlm.exe -c cntlm.ini -I -M http://google.com gave the error Connection to proxy failed, bailing out.

I also tried pip install -–proxy=user:pass@localhost:3128 (the default CNTLM port) but that raised Cannot fetch index base URL http://pypi.python.org/simple/. Clearly something's up with the proxy.

Does anyone know how to check more definitively whether CNTLM is set up right, or if there's another way around this altogether? I know you can also set the http_proxy environment variable as described here but I'm not sure what credentials to put in. The ones from cntlm.ini?

Thanks!


Source: (StackOverflow)

Advertisements

How do I pull from a Git repository through an HTTP proxy?

Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP.

I have a project under Git control. I'd like to add a submodule:

git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu

But I get

...
got 1b0313f016d98e556396c91d08127c59722762d0
got 4c42d44a9221209293e5f3eb7e662a1571b09421
got b0d6414e3ca5c2fb4b95b7712c7edbf7d2becac7
error: Unable to find abc07fcf79aebed56497e3894c6c3c06046f913a under http://github.com/jscruggs/metri...
Cannot obtain needed commit abc07fcf79aebed56497e3894c6c3c06046f913a
while processing commit ee576543b3a0820cc966cc10cc41e6ffb3415658.
fatal: Fetch failed.
Clone of 'http://github.com/jscruggs/metric_fu.git' into submodule path 'vendor/plugins/metric_fu'

I have my HTTP_PROXY set up:

c:\project> echo %HTTP_PROXY%
http://proxy.mycompany:80

I even have a global Git setting for the http proxy:

c:\project> git config --get http.proxy
http://proxy.mycompany:80

Has anybody gotten HTTP fetches to consistently work through a proxy? What's really strange is that a few project on GitHub work fine (awesome_nested_set for example), but others consistently fail (rails for example).


Source: (StackOverflow)

How do I have to configure the proxy settings so Eclipse can download new plugins?

I am working with Eclipse 3.7, on an Windows XP environment behind a web proxy.

I want to install the Groovy plugin on a newly unzipped Eclipse Indigo (Eclipse Java EE Indigo M4). I added the update site to the Available Software Site list.

But Eclipse is not able to retrieve the information of this plugin, and thus the installation is not possible...

If I put Native configuration in General > Network Connections, which does not have the Auth option selected, I get the following error when I trying to reach the update site:

HTTP Proxy Authentication Required: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/content.xml
HTTP Proxy Authentication Required: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/content.xml
Proxy Authentication Required

So now, I select manual, I define all correct information for the three schemas (HTTP, HTTPS, SOCKS): proxy, port, Auth, User and password. However, when I try to reach the update site, Eclipse is indicating that he is Fetching children of Groovy Eclipse, but keep this status at 0%...

What is strange is that even if I put a wrong password in the General > Network Connections configuration, I don't get any error message.

My questions:

  • What is wrong in my configuration?
  • Is there another way to define the proxy configuration?
  • Is there a way to get more information, to know what Eclipse is trying to do (the workspace/.metadata/.log doesn't contain any useful information) ?

Another problem (minor however) is that the modifications of the proxy settings seem to be handled only after an Eclipse restart.


ps1: Using my browser, I can reach the update site, so it is not blocked by the proxy.

ps2: This problem is not related to this plugin, as Eclipse behaves the same way for other plugin.

ps3: Here is the content of the workspace/.metadata/.log when I start Eclipse and try to install the plugin (all these logs are written during the startup, none when Eclipse tries to access the update site)

!SESSION 2011-05-02 10:38:58.681 -----------------------------------------------
eclipse.buildId=I20101208-1300
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.228
!MESSAGE System property http.proxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.228
!MESSAGE System property http.proxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyPort is not set but should be 8080.

!ENTRY org.eclipse.osgi 2 1 2011-05-02 10:39:02.447
!MESSAGE NLS missing message: TaskJobFactory_Refreshing_repository_configuration in: org.eclipse.mylyn.internal.tasks.ui.messages

Edit

If I add the following lines in my eclipse.ini file (because of that), it works:

-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dhttp.proxyPort=8080
-Dhttp.proxyHost=XXX
-Dhttp.proxyUser=XXX
-Dhttp.proxyPassword=XXX
-Dhttp.nonProxyHosts=localhost|127.0.0.1

But why? Does this problem still exists in Eclipse 3.7?


Source: (StackOverflow)

How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?

... or am I just being lazy?

Note: rubysspi-1.2.4 does not work.

This also works for "igem", part of the IronRuby project


Source: (StackOverflow)

Getting git to work with a proxy server

How do I get git to use a proxy server?

I need to check out code from a git server, it shows "Request timed out" every time. How do I get around this?

Alternatively, how can I set a proxy server?


Source: (StackOverflow)

Difference between proxy server and reverse proxy server

What is the difference between proxy server and reverse proxy server?


Source: (StackOverflow)

How to clear https proxy setting of NPM?

How can I clear the previous ssl proxy setting of NPM? well, I search a lot, but all post I got is mainly about how to set proxy in corporate network.

I try to set proxy to nothing:

npm config set http-proxy
npm config set https-proxy

the first command pass yet the second one warn that:

npm WARN invalid config proxy=""
npm WARN invalid config Must be a full url with 'http://'

is the warning neglectable and I have successfully clear the proxy setting?


Source: (StackOverflow)

spring scoped proxy bean

Can someone explain the usage of the spring @ScopedProxy annotation? I thought it had something to do with session scoped beans, but I'm not quite sure what.

In my usage of scopes, I've used session scoped beans without the @ScopedProxy annotation (or without aop scoped proxies), so I'm really sure how to use it properly.


Source: (StackOverflow)

file_get_contents behind a proxy?

At work we have to use a proxy to basically access port 80 for example, we have our own custom logins for each user.

My temporary workaround is using curl to basically login as myself through a proxy and access the external data I need.

Is there some sort of advanced php setting I can set so that internally whenever it tries to invoke something like file_get_contents() it always goes through a proxy? I'm on Windows ATM so it'd be a pain to recompile if that's the only way.

The reason my workaround is temporary is because I need a solution that's generic and works for multiple users instead of using one user's credentials ( Ive considered requesting a separate user account solely to do this but passwords change often and this technique needs to be deployed throughout a dozen or more sites ). I don't want to hard-code credentials basically to use the curl workaround.


Source: (StackOverflow)

Proxy with urllib2

I open urls with:

site = urllib2.urlopen('http://google.com')

And what I want to do is connect the same way with a proxy I got somewhere telling me:

site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})

but that didn't work either.

I know urllib2 has something like a proxy handler, but I can't recall that function.


Source: (StackOverflow)

How do I run Node.js on port 80?

My aim is to run Node.js on port 80. This is because I am finding node.js is being blocked from certain networks which do not allow traffic from any other port.

It appears that the best way to do this is by proxying Apache through Node.js. I have tried using node-http-proxy to do this but I have not had any luck.

The code I am using is here:

var util = require('util'),
    http = require('http'),
    httpProxy = require('http-proxy');

httpProxy.createServer(9000, 'localhost').listen(80);

http.createServer(function (req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
  res.end();
}).listen(9000);

But I keep getting the error "Address in use" for port 80. I must be doing something wrong.

How do I proxy Apache through node.js using node-http-proxy? Will this enable me to run node.js on port 80? And is node-http-proxy the best way to achieve this?

Thank you.


Source: (StackOverflow)

GitHub Windows client behind proxy

I'm trying to get the GitHub client for Windows working. I am on a corporate Win 7 x64 computer behind a corporate proxy and firewall. Following various other posts and experimenting with multiple combinations of environment variables and config variables I have found the only way to get cloning and push updates to work is by using the HTTPS_PROXY environment variable, including my full corporate domain user ID and password.

This is unacceptable from a security standpoint. Is there any other way to get this to work?

Additional notes:

The following worked:

  • Add an environment variable called HTTPS_PROXY with the value http://[domain]\[userid]:[password]@someproxy.mycorp.com:8080

The following did not work:

  • Omitting user id and password from HTTPS_PROXY variable
  • Using an environment variable called HTTP_PROXY (no S)
  • Adding the http.proxy variable to the global config file (.gitconfig)
  • Adding the https.proxy varaible to the global config file

In all cases, the GitHub client still does not recognize the proxy: The content of the file TheLog.txt always shows the following on startup:

[time]|INFO|thread:4|GitHub.Helpers.StartupLogger|Proxy information: (None)
[time]|INFO|thread:4|GitHub.Helpers.StartupLogger|Couldn't fetch creds for proxy

And is followed by the output of several failed proxy authentication attempts, all of which indicate "Credentials are missing."


Source: (StackOverflow)

How to use CURL via a proxy?

I am looking to set curl to use a proxy server. The url is provided by an html form, which has not been a problem. Without the proxy it works fine. I have found code on this and other sites, but they do not work. Any help in finding the correct solution would be much appreciated. I feel that the bellow are close, but that I am missing something. Thank You.

The bellow code I adapted from here http://www.webmasterworld.com/forum88/10572.htm but it returns an error message about a missing T_VARIABLE on line 12.

<?

$url = '$_POST[1]';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, '66.96.200.39:80');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt ($ch, CURLOPT_HEADER, 1)
curl_exec ($ch); 
$curl_info = curl_getinfo($ch);
curl_close($ch);
echo '<br />';
print_r($curl_info);
?>

The bellow is from curl through proxy returns no content

<?

$proxy = "66.96.200.39:80";
$proxy = explode(':', $proxy);
$url = "$_POST[1]";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxy[0]);
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy[1]);
curl_setopt($ch, CURLOPT_HEADER, 1);

$exec = curl_exec($ch);

echo curl_error($ch);
print_r(curl_getinfo($ch));
echo $exec;
?>

is currently live on pelican-cement.com but also does not work.

UPDATE: Thank you for all your help, I made the above changes. Now it only returns a blank screen.

<?

$url = $_POST['1'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, '66.96.200.39:80');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_exec ($ch); 
$curl_scraped_page = curl_exec($ch);
curl_close($ch);

echo $curl_scraped_page;
?> 

Source: (StackOverflow)

Getting RAW Soap Data from a Web Reference Client running in ASP.net

I'm trying to trouble shoot a web service client in my current project. I'm not sure of the platform of the Service Server (Most likely LAMP). I believe there is a fault on their side of the fence as i have eliminated the potential issues with my client. The client is a standard ASMX type web reference proxy auto generated from the service WSDL.

What I need to get to is the RAW SOAP Messages (Request and Responses)

What is the best way to go about this?


Source: (StackOverflow)