php sdk working only in https connections |
Yes, I do have it working with just http. You can check out my site:
http://www.pittsburghpartycentral.com/connect.php
|
Why is Go HTTPS Client not reusing connections? |
Based on further clarification from the OP. The default client does reuse
connections.
Be sure to close the response.
Callers should close resp.Body when done reading from it. If resp.Body is
not closed, the Client's underlying RoundTripper (typically Transport) may
not be able to re-use a persistent TCP connection to the server for a
subsequent "keep-alive" request.
Additionally, I've found that I also needed to read until the response was
complete before calling Close().
e.g.
res, _ := client.Do(req)
io.Copy(ioutil.Discard, res.Body)
res.Body.Close()
To ensure http.Client connection reuse be sure to do two things:
Read until Response is complete (i.e. ioutil.ReadAll(resp.Body))
Call Body.Close()
Old answer, useful for rate limiting, but not what the OP was after:
I d
|
Ksoap2 with https uses a lot of bandwitch How to optimize connections? |
I faced the same problem.
My WS always returned the whole object I requested.
So I manage that the server stores for each object its last updated time by
using System.currentTimeMillis() in every setters.
When you consume your WS you retrieve the response and keep the last
updated time.
For the next request to the WS, you'll send this stored time.
So the server will send you only the difference. Of course, it leads to a
modification of your server's code.
I don't know if it's a clean solution, but it works fine. I've got
approximatively the same time response in Wifi and in 3G.
You can also use gzip to compress the message.
HeaderProperty headerProperty=new HeaderProperty("Accept-Encoding",
"gzip");
You can see a sample here
|
Tomcat blocking when handle huge HTTPS connections |
change maxThreads value to hit count on server.xml file and check
<Connector port="****" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
/>
|
how to write HTTPS route in mvc 4 |
MVC routes only match the path portion of the URL.
They are completely independent of host or protocol.
If you want to restrict some URLs to HTTPS only, add the [RequireHttps]
attribute to the controller or action.
|
Force HTTPS in route generation |
You could use the RouteUrl method which allows you so specify the protocol
and thus generate an absolute URL with this protocol:
@Url.RouteUrl(
"DefaultApi",
new { httproute = "", controller = "People" },
"https"
)
Notice the httproute = "" route value to indicate that we want to generate
a route for a Web API controller and not MVC controller.
|
Port routing in Heroku to route all http to https |
I check https within Express and redirect if necessary:
(are you using Express?)
function requireSecure(req, res, next){
if(!req.secure){
var port = app.myConfig.httpsPort || 443;
if(port != 443){
res.redirect('https://'+req.host+':'+port+req.originalUrl);
console.log('redirecting to
https://'+req.host+':'+port+req.originalUrl);
} else {
res.redirect('https://'+req.host+req.originalUrl);
console.log('redirecting to https://'+req.host+req.originalUrl);
};
} else {
next();
};
}
// place before any other route to ensure all requests https
app.all('*', requireSecure);
// You can instead protect individual routes like this:
app.get('/account'
, requireSecure
, function(req, res, next){
res.send(200, 'This route is definitely secure!
|
C HTTP Server & OpenSSL - Works fine for HTTP - Multiple/rapid/concurrent connections being dropped using HTTPS |
You should call SSL_accept() in your request handling thread. This will
allow your listening thread to process the TCP accept/listen queue more
quickly, and reduce the chance of new connections getting a RESET from the
TCP stack because of a full accept/listen queue.
SSL handshake is compute intensive. I would guess that your spammer is
probably not using SSL session cache, so this causes your server to use the
maximum amount of CPU. This will cause it to be CPU starved in regards to
servicing the other connections, or new incoming connections.
|
Amazon Route 53 to map an address like https://my-elb-address:88888/my-app-name |
There's a few problems with that:
First, DNS cannot include port numbers.
Second, DNS cannot include a path.
Third, the maximum port number is 65535, so even if DNS did let you add a
port number, that port number is too high.
You'll probably want to just send your domain directly to the server. Use
apache to reverse proxy 80/443 to 8080/8009 (glassfish default ports for
http/ajp), and just add a mod_rewrite rule that redirects / to /my-app.
|
IIS SQL Server: Connection Pool: Why are new connections made instead of reusing existing connections? |
If the connections are coming from a different machine, the connections
can't be pooled. A connection required both endpoints to be a connection.
If you are using connection pooling correctly, applications instantiate a
connection (from the pool), use the connection, then drop it as soon as
exchange is complete.
If you a writing a single-threaded desktop app, another common and simple
strategy is to open a connection, and just leave that connection open as
long as the application is running.
You can control how many connections are created, etc. see MS article for
more details related to connection pooling.
IIRC, connection pools are not shared unless the connection string is
identical either.
|
Is it possible to create different connections per client in SignalR? Persistent Connections |
You could use my lib for this called
SignalR.EventAggregatorProxy
Install using nuget
Install-Package SignalR.EventAggregatorProxy
It takes care of the Hub and connection details for you under the hood, so
that you only need to subscribe and publish events
Check wiki for how to set it up
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy/wiki
Once set up all you need todo to get it to listen to a back end event from
javascript is
ViewModel = function() {
signalR.eventAggregator.subscribe(MyApp.Events.TestEvent,
this.onTestEvent, this);
};
You can listen to how many events you want on only one connection and one
hub
|
DB's long-live connections or on-demand connections? |
You don't say what database access library you are using (ODBC, ado.net,
other?). Opening and closing database connections is a relatively
expensive operation. You should be using some sort of connection pooling
scheme in your db access framework. A pool of connections is opened for a
period of time, and when your app opens a connection it will get handed an
already open connection from a pool. That will make it more efficient. Go
read about connection pooling
for SQL Server
|
Too many connections Error due to many sleep connections |
A good solution for this is to put your connection into a function, then
add a destructor to close the connection for you. That way the connection
automatically closes the after the last time the mysql connection is
called.
class DbConn {
public $connection;
public function __construct($host, $name, $user, &$pass) {
$this->connection = mysql_connect(mysql_connect($host, $user,
$pass);
if(mysql_connect_errno) {
echo mysql_connect_error;
} else {
mysql_select_db($name, $this->connection);
}
unset($pass); //Clear password for security.
}
public function __destruct() {
mysql_close($this->connection);
}
}
That should take care of most open connections as they will close before
the end o
|
Facebook like button https issue: protocol mismatch from http and https |
Reviewing the js code on Facebook there are multiple urls containing hard
coded strings for
http://static .../rsrc.php
it's possible those are the files triggering the error.
This may be something Facebook needs to update.
On a side note, it may be possible to download that js file from Facebook
and store it on your server and remove the hard coded http string. I would
test this further but I am on my phone at the moment.
|
Once https page is visited, all subsequent pages are served from https |
ok I think I found the reason. The links I am visiting are relative, so
"/forum" for example. Once https is in the browser it seems like visiting
a relative address is leaving the root as https:// and appending the
relative path.
I believe the fix here will be to use the full path for the link instead of
relative.
|
How do you enable https and http->https redirects in ring / compojure |
It's possible to serve HTTPS with clojure, but it's much more popular to
put nginx or something like that in front of your ring server. If you can
figure out how to configure jetty, though, run-jetty clearly supports SSL.
|
when using https, https can't find codeigniter controllers. Running Centos |
Change this line :
RewriteRule ^(.*)$ index.php?/$1 [L]
to :
RewriteRule ^(.*)$ /index.php?/$1 [L]
The .htaccess would otherwise be redirected relatively to a index.php in
the join folder, which off course is not there.
|
How can i convert links to https when server providing https? |
If you remove the http:// portion and use instead:
<script type="text/javascript"
src="//static.monstermmorpg.com/js_files/jquery-1.9.1.min.js"></script>
It should request based on the current scheme being used.
|
Redirect all http AND https non-www URLS to https://www.xyz.com via htaccess |
In case anyone from the future (HELLO PEOPLE OF THE FUTURE) stumble across
this, I asked the same question and had it answered over at Server Fault.
Short version: impossible.
Long version:
http://serverfault.com/questions/523199/redirect-all-http-and-https-non-www-urls-to-https-www-example-com-via-htaccess
|
Can https fallback to http and security level of https |
No, HTTPS never falls back to HTTP automatically. It would take deliberate
action by the user. If you're just going to a web page by putting its URL
into the address bar, this is easy; for form submission it's harder.
Yes, sending plain text over SSL is fine. In fact, sending a hashed
password doesn't really increase security much at all -- if someone manages
to sniff the connection and gets the hashed password, that's all they need
to be able to login to the site. It has one small advantage: if the user
uses the same password at multiple sites, learning the hashed password for
one site doesn't help them get into another site that uses a different (or
no) hash. And it's not likely to be feasible to send salted hashes, since
the client doesn't know the salt.
A cnonce adds an extra level
|
HTTPS GET request to https://www.googleapis.com/plus/v1/people/me |
Create a Google_Oauth2Service object (put it under the $plus
initialization), like:
$client = new Google_Client();
$plus = new Google_PlusService($client);
$oauth2 = new Google_Oauth2Service($client);
and after succesfully authenticating the client use:
$userInfo = $oauth2->userinfo->get();
$email = $userInfo['email'];
|
Rails Route not working despite link being correct and route appearing in "rake routes" |
I think you are creating a nested resource for two models
app model and content model. right?
Here's for show something like /apps/101010/contents/90909090
<%= link_to 'Show', app_content_path(@app, content) %>
On controller following like this:
def show
@content = @app.content.find(params[:id])
end
Read this for creating-nested-resources
|
How can I pair driving directions route segments with the names of the route in Google Maps API V3? |
The DirectionsStep object has a property called end_location. You could get
this value and display it in an info window?
https://developers.google.com/maps/documentation/javascript/reference#DirectionsLeg
|
Laravel 4 Auth Filter: Unable to generate a URL for the named route as such route does not exist |
change
Route::get('fans/landing', array('uses' =>
'FansController@getIndex'))->before('guest');
to
Route::get('fans/landing', array('as' => 'fans.landing', 'uses' =>
'FansController@getIndex'))->before('guest');
and change
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::route('fans/landing');
});
to
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::route('fans.landing');
});
|
RedirectToAction in MVC3 returns "No route in the route table matches the supplied values" |
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}/{id1}/", // URL with parameters
new { controller = "Home",
action = "Index",
id = UrlParameter.Optional,
id1 = UrlParameter.Optional
} // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}", // URL with parameters
new { controller = "Home", action = "Index" } // Parameter defaults
);
}
If you pay attention to the above code you were missing the default route
without parameters.
|
Forward any route with upper case character to equivalent lowercase route in Kohana 3.3 |
If you do not want any of your routes to be case-sensitive, simply extend
the route class:
class Route extends Kohana_Route {
public static function compile($uri, array $regex = NULL)
{
return parent::compile($uri, $regex).'i';
}
}
|
Cancel route and redirect to other route without displaying the original content in AngularJS |
The first answer should work, but to do it using $q I would use
defer.resolve() or defer.reject("rejection_reason") then I would listen for
a $routeChangeError in a top-level controller that is bound to an an
element outside of the ng-view that the routeProvider manages.
So in your HTML, something like:
<body ng-app="app" ng-controller="DocumentCtrl">
<div ng-view>
</div>
</body>
Then that route of yours would be defined something like:
when('/home', {
templateUrl: templateUrl blah,
controller: baseName + 'Controller',
resolve: {
load: function($q, MY_USER_SERVICE){
var defer = $q.defer();
if(~MY USER LOGGED_IN LOGIC RETURNS TRUE~){
defer.resolve();
} else {
defer.reject("not_logged_in");
}
return defe
|
Unable to generate a URL for the named route "regions.index" as such route does not exist |
You have not named your routes.
You should change
Route::get('regions', 'RegionsController@index');
to
Route::get('regions', array('as'=>'regions.index', 'uses'=>
'RegionsController@index');
|
How should I route CMS urls alongside optional paramters / actions in route config? |
Eventually I stumbled across the answer here:
Dynamic Routes from database for ASP.NET MVC CMS
The answer is to provide a custom route constraint that checks the DB for
existence of the CMS url.
|
IHttpHandler to redirect "https://example.com" to "https://www.example.com"? |
If you use IIS7, you might want to try URL Rewrite Module.
http://www.4guysfromrolla.com/articles/072810-1.aspx
http://www.jppinto.com/2010/03/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0/
|
Adding @Html.Action to _layout errors with "No route in the route table matches the supplied values." |
Solved (but I do not understand "Areas, something more to learn").
I changed the line @Html.Action("OVars","MyO") to
@Html.Action("OVars","MyO", new { area = string.Empty }).
I kept making code changes until I received an error message that when I
looked it up found some text similar to "This error could also happen if
inside a view in your area, you use the Html.Action helper. This helper
will always use the area as a prepend, unless you specifically tell it not
to.". The example presented was to add , new { area = string.Empty } to the
@Html.Action statement.
Now the @Html.Action is working correctly and I can move forward with
having the controller access the database for information.
Next up on the learning agenda is "Understanding Areas".
|
defining redirecting route in ember causing other route to not work |
If you define a resource in your router map then analytics.index is an
implicit route and should not be defined explicit. The default behaviour is
then that your analytics.index template will be rendered into your
analytics template's outlet in the place where you have an {{outlet}}
defined.
So for example this should work as expected:
AS.Router.map(function(){
this.resource('analytics', {path: '/analytics'}, function(){
this.route('config', {path: '/config'});
);
});
This will render correctly the analytics.index template into the analytics
template outlet.
If your analytics route should be directly accessible when navigating to
"/" and you want your user to be redirected to /analytics then you should
redirect from your IndexRoute instead:
AS.IndexRoute = Ember.Route.extend
|
Rails 3 - How to escape from subdomain route to the normal route? |
Rails takes the first matching path defined in the routes.rb file. If you
are on the subdomain the constraint matches and match "/" matches as root
path.
Try move "root :to => 'items#index'" to the top of your routes.rb file.
|
Using default route parameters for non-required Kohana Route::url |
It seems to me that you are trying to fix your routing by using 1 route for
all. This is not the right way to do things.
Just make multiple routes (maybe you have to tweak this):
Route::set('my_route',
'r/<controller>(/<action>)/(<name>-)<hash>', array(
'controller' => '[a-z]+',
'action' => '[a-z]+',
'hash' => 'w{13}',
'name' => '[a-z]+',
))->defaults(array(
'directory' => 'my_dir',
'controller' => 'welcome',
'action' => 'index',
'name' => null,
));
Route::set('my_route2', 'r/<controller>(/<action>)', array(
'controller' => '[a-z]+',
'action' => '[a-z]+',
'hash' => 'w{13}',
'name' => '[a-
|
Laravel 3.x Route issue: page not found even with the route set |
EDIT: Heads up
Your routes are in a bad order. Reverse them. Routes are evaluated top
down, so anything with admin/products in the route will route to
admin.products@index and nothing else.
In your edit method, you need to have the id parameter defined.
Since you didn't post your controller, I'm assuming this is why, since the
closure does not have the $id passed to it. Example:
// Required user id:
Route::get('admin/users/edit/(:num)', function($id)
{
return "Holy Hell.";
});
// Optional user id:
Route::get('admin/users/edit/(:num?)', function($id = null)
{
return "Holy Hell.";
});
In your case, you probably don't want the optional part unless you plan on
spewing out an error (or redirecting on error).
|
LARAVEL 4: share data between Route::filter and Route::get |
A possible implementation would be to use a cache:
Route::get('dashboard/objects/add', array('before'=>'objectadd',
function(){
return Cache::get('objectadd');
});
Route::filter('objectadd', function(){
$filter_data = 'Some data';
Cache::forever('objectadd', $filter_data);
});
Though why bother to use a filter if you're just gonna use it this way?
|
Ember parent route redirection to child route |
Using the your current router mapping, you have the routes index.manage and
label.notes.
When the page is refreshed in the index.manage, first it will transition to
the parent route, in that case the index, and after to manage. But in you
index you have the redirect, so the manage isn't processed.
Just remove of your mapping the resource('index') and update your manage
route to reflect the new configuration, so link-to index.manage will become
manage, and data-template-name=index/manage to manage etc.
The updated route mapping is the following:
App.Router.map(function () {
// this.route('index', { path: '/' }); generated by ember
this.resource('label', { path: '/label' }, function() {
this.route('notes', { path: '/:label_id' });
});
this.route('manage', { path: '/manage'
|
How to re-route directions if original route is detour by user in wp8 |
It sounds like you only query for the route one time. You should actively
query for the route with the user's current location.
See how to get the current location using the GeoLocator for WP8.
http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator
Subscribe to the position changed event to get a notification when the
user's position changes.
http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.positionchanged
|
Is it possible to use Route::Connect to route to a query string parameter? |
If a redirect is ok, then this should do it:
RewriteRule ^upload:(d+)$ /uploads/upload?upload=$1 [R=302,L]
Use the .htaccess file located in app/webroot/ and you should be good. See
this example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [S=2]
RewriteRule ^upload:(d+)$ /uploads/upload?upload=$1 [R=302,L]
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
It's the original .htaccess file, modified to make the rewrite conditions
(that check whether the requested target is an actually existing file or
folder) apply for the last two rewrite rules. This works by skipping the
last two rules ([S=2]) in case the conditions are true.
See also Multiple RewriteRules for
|
FOSUserBundle "Register" route redirects to "Login" route |
As pointed out by m0c.
In my config.yml file I had that the ^/ path should only be accessed by
authenticated users, and I only whitelisted the ^login$ path, not the
^/register$ path.
removing ^/ the roles for that path, solved this issue.
|