Alamofire with a self-signed certificate / ServerTrustPolicy

You need to add the port domain when you create your ServerTrustPolicy dictionary. let defaultManager: Alamofire.Manager = { let serverTrustPolicies: [String: ServerTrustPolicy] = [ “localhost:3443”: .DisableEvaluation ] let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() configuration.HTTPAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders return Alamofire.Manager( configuration: configuration, serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies) ) }()

How do I tell WCF to skip verification of the certificate?

You might be able to achieve this in Silverlight by allowing cross-domain communication between the web server the hosts the Silverlight application and the remote WCF service. In that case you need to place a clientaccesspolicy.xml file at the root of the domain where the WCF service is hosted: <?xml version=”1.0″ encoding=”utf-8″?> <access-policy> <cross-domain-access> <policy> … Read more

Android SSL HttpGet (No peer certificate) error OR (Connection closed by peer) error

The following source should fix your problem. import android.app.Activity; import android.widget.EditText; import android.os.Bundle; import org.apache.http.HttpResponse; import org.apache.http.Header import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import android.util.Log; import android.view.Menu; public class MainActivity extends Activity { private EditText text; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = (EditText) findViewById(R.id.editText1); connect(); } private void connect(){ try { … Read more

Getting the location from a WebClient on a HTTP 302 Redirect?

It’s pretty easy to do Let’s assume you’ve created an HttpWebRequest called myRequest // don’t allow redirects, they are allowed by default so we’re going to override myRequest.AllowAutoRedirect = false; // send the request HttpWebResponse response = myRequest.GetResponse(); // check the header for a Location value if( response.Headers[“Location”] == null ) { // null means … Read more

Unable to tunnel through proxy. Proxy returns “HTTP/1.1 407” via https

Change in Java 8 Update 111: Now, proxies requiring Basic authentication when setting up a tunnel for HTTPS will no longer succeed by default. If required, this authentication scheme can be reactivated by removing Basic from the jdk.http.auth.tunneling.disabledSchemes networking property, or by setting a system property of the same name to “” ( empty ) … Read more

nginx redirect HTTPS to HTTP

The answer above will work, you need to generate a self signed cert (or have a real one) and configure nginx as such: server { listen *:443; ssl on; server_name domain.com; rewrite ^(.*) http://domain.com$1 permanent; ssl_certificate /data/certs/domain.crt; ssl_certificate_key /data/certs/domain.key; } Keep in mind, if it is a self signed cert the browser will give you … Read more

How to make Sinatra work over HTTPS/SSL?

this seems to do it for me: require ‘sinatra/base’ require ‘webrick’ require ‘webrick/https’ require ‘openssl’ CERT_PATH = ‘/opt/myCA/server/’ webrick_options = { :Port => 8443, :Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG), :DocumentRoot => “/ruby/htdocs”, :SSLEnable => true, :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, :SSLCertificate => OpenSSL::X509::Certificate.new( File.open(File.join(CERT_PATH, “my-server.crt”)).read), :SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open(File.join(CERT_PATH, “my-server.key”)).read), :SSLCertName => [ [ “CN”,WEBrick::Utils::getservername ] ] } … Read more

HTTPS Proxy Server in node.js

Solutions barely exist for this, and the documentation is poor at best for supporting both on one server. The trick here is to understand that client proxy configurations may send https requests to an http proxy server. This is true for Firefox if you specify an HTTP proxy and then check “same for all protocols”. … Read more