SignalR getting 403 on AppHarbor after updating to v. 1.0.1 (Chrome) - asp.net-mvc-4

I was using SignalR v. 1.0.0 RC2, and it worked fine. When I upgraded to v. 1.0.1 it stopped working. I am now getting a 403 (forbidden) when I am trying to invoke a method on the hub. I did not change any code - I only updated to the newer version of SignalR. It is important to note that I do not have any problems when I run it locally - only when I run it on AppHarbor, and only in the Chrome browser. It works in IE 10 and Firefox 20.
I know that some work has been done in the newer version of SignalR for authorization. Now you can add an Authorize attribute on your hub, or your hub methods. I want to do that, but first I would like it to work without - like it did before.
This is my hub:
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
public class ReceptionHub : Hub
{
public Task Join(string group)
{
return Groups.Add(Context.ConnectionId, group);
}
}
And this is the client site script (I get the group from a data attribute in the markup):
$(function () {
var receptionHub = $.connection.receptionHub;
receptionHub.client.updateStatusBar = function (checkedIn, checkedOut, preRegistered)
{
$('#quantityCheckedInToday').html(checkedIn);
$('#quantityCheckedOutToday').html(checkedOut);
$('#quantityPreRegistered').html(preRegistered);
};
$.connection.hub.start().done(function () {
var group = $("#statusBar").data("group");
receptionHub.server.join(group);
});
});
One difference between my local setup and the setup on AppHarbor is that I run the AppHarbor site on HTTPS, but that was not a problem before. Also, there is a loadbalancer infront of the server on AppHarbor.
The request that fails is a POST request to this URL:
/signalr/send?transport=serverSentEvents&connectionToken=5hSSl7wSPrkD51cmPNw-JCrrdxMn2qOgEgmKt5gKrE4jigE4Sxha3gALHREcyDslqb7xjY9fP8rTMpslKuBJzBCIi-q86ZmHt66xhqi2eioAtvQCO03XlcR0Dq9-RW5G0
Any help is much appreciated

I have now tried using SignalR 1.1.2 - and it still did not work in Chrome, but this time it gave a much better error message. It said that CORS was turned off. I tried turning CORS on in the configuration:
var config = new HubConfiguration
{
EnableCrossDomain = true
};
// Register the default hubs route: ~/signalr
RouteTable.Routes.MapHubs(config);
This fixed the problem I was having, and now it works again in Chrome. I am not sure why CORS needs to be turned on to get it working in Chrome... maybe some special AppHarbor setup.

Related

Selenium iOS Driver behind Proxy

We are trying to run some automated tests for our Xamarin based iOS app using the Selenium IOSDriver within Visual Studio for Mac.
The error we are getting when we run them is (I've sanitised to remove the URL we are actually trying to send the request to).
A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL https://<Test Host URL>. The status of the exception was NameResolutionFailure, and the message was: nodename nor servname provided, or not known nodename nor servname provided, or not known
Because our machines are behind a proxy we often see DNS errors like this when the code sending the request is unaware of the proxy.
We've tried various approached to setting the proxy, such as HttpClient.DefaultProxy and OpenQA.Selenium.Proxy but the error still persists.
Are there any other ways to tell Selenium that it is operating behind a proxy?
For anyone else struggling with this the answer seemed to be using a 'HttpCommandExecutor'
var uri = new Uri("https://hub.browserstack.com/wd/hub/");
var commandExecutor = new HttpCommandExecutor(uri, TimeSpan.FromSeconds(30))
{
Proxy = new WebProxy
{
Address = new Uri("http://your.proxy")
}
};
driver = new IOSDriver<IOSElement>(commandExecutor, options);

302 Error: Laravel 5.4 in SSL AWS ELB Load Balancer

We've deployed a Laravel 5.4 app on AWS (Elastic Beanstalk) with a middleware installed, namely: laravel-ssl-protocol (by resino), which is to force SSL. We've included it on the Kernel.php
protected $middleware = [
...
\Riseno\SSLProtocol\SSLMiddleware::class,
];
It works perfectly on the Homestead/local machine. But it doesn't work on the server (AWS ELB). I attached the actual image or the problem.
firefox and chrome too many redirect
Any idea on how to resolve this issue would be much appreciated. Thanks.
I finally found the fix of my problem and I think I need to share it here. So if somebody with the same problem that I had, this might help them. As I did some research on the web I found this article: How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy . And did some minor change on the current middleware, laravel-ssl-protocol (by resino) as follows:
public function handle($request, Closure $next)
{
$request->setTrustedProxies([$request->getClientIp()], Request::HEADER_X_FORWARDED_AWS_ELB);
if (!$request->secure() && env('APP_ENV') === 'production') {
return redirect()->secure($request->path());
}
return $next($request);
}
And uploaded the updated codebase to AWS and tada! It works. The 302 error was gone for good. The key was "Request::HEADER_X_FORWARDED_AWS_ELB".

Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports

I trying to setup RestComm Web SDK demo application on my local system, I just want to create an application for audio/video, chat, IVR, etc(RestComm provide me perfect solution for my needs). Now I have setup RestComm Web SDK on my local system and whenever I an trying to sip call, It throws WebRTCommClient:call(): catched exception:NotSupportedError: Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports on browser console.
My webRTC confrigration is as below:
// setup WebRTClient
wrtcConfiguration = {
communicationMode: WebRTCommClient.prototype.SIP,
sip: {
sipUserAgent: 'TelScale RestComm Web Client 1.0.0 BETA4',
sipRegisterMode: register,
sipOutboundProxy: parameters['registrar'],
sipDomain: parameters['domain'],
sipDisplayName: parameters['username'],
sipUserName: parameters['username'],
sipLogin: parameters['username'],
sipPassword: parameters['password'],
},
RTCPeerConnection: {
iceServers: undefined,
stunServer: 'stun.l.google.com:19302',
turnServer: undefined,
turnLogin: undefined,
turnPassword: undefined,
}
};
While I can use olympus without any issue in Chrome Browser. I am stuck with this exception, any suggestions would be highly appreciated.
I think the problem here is that the version of Webrtcomm library inside the demo application you are using is outdated and doesn't include a fix for latest Chrome version. So please replace samples/hello-world/scripts/WebRTComm.js within your repository, with:
https://github.com/RestComm/webrtcomm/blob/master/build/WebRTComm.js
That should fix your issue.
Best regards,
Antonis Tsakiridis

MVC 4: Durandal bundling cache

My site is built on a WebAPI back end...
the issues occurs on deployment, as my Uri wasn't formatted correctly due to our IIS deployment/site structure
WRONG
http://itil.mysite.com/api/Building
RIGHT
http://itil.mysite.com/TestSite/api/building
So I modified my http helper to include a baseUri
like so
define(function () {
var baseUri = window.AppPath;
return {
baseUri: baseUri,
defaultJSONPCallbackParam: 'callback',
get: function (url, query) {
return $.ajax(baseUri + url, { data: query });
},
...
});
And on my Index.cshtml
added the following to get the set the root/baseUri path:
var AppPath = '#string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"))';
console.log('AppPath: '+AppPath);
The baseUri path is correct when I log it to the console from the Index.cshtml: EG.
AppPath: http://itil.mysite.com/TestSite/
But when I do the actual api call (from my deployed instance), it still uses the old Uri..
http.get('api/building').done(viewInit);
STILL WRONG
http://itil.mysite.com/api/building
My next thought was that the files must be cached somehow, so I tried the following:
Restarted IIS numerous times,
Deleted and redeployed files
Disabled Caching in chrome,
Disabled .js caching in IIS (usermode & kernel
mode),
Restarted my PC
Modified the ScriptBundle to try and force it
to (for the lack of a better word) go out of sync, then added my
code back
The code works when i use my Visual Studio dev server, but I'm getting the
same issue on my local IIS & Alpha test site... with no luck.
How the hell do i clear the cache on a deployed site :/ This is getting to the point where things seems to be a bit ridiculous. Either I'm losing it, or the "big guy" hates me.
Sigh.. Second time I've been caught out by this. I thought my issue was MVC related, its was Durandal deployment related :P
Note to everyone reading this.
Once you deploy a Durandal project & if you modify ANY of the existing javascript files or main.js. Remember to run optimizer.exe.
...\App\durandal\amd\optimizer.exe

Java scribe does not generate signature on Tomcat

I am using scribe 1.3.0 for OATH authentication. This is on Tomcat 7 under Ubuntu.
I am pretty sure this is some sort of a pilot error but cannot figure out what is wrong exactly...
I create the service and token in the constructor of my client class:
public Client()
{
m_service = new ServiceBuilder()
.provider(Api.class)
.apiKey(CONSUMER_KEY)
.apiSecret(CONSUMER_SECRET)
.debug()
.build();
m_accessToken = new Token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
}
Later on when time comes to make a request I use the service in a function:
OAuthRequest request = new OAuthRequest(Verb.GET,
url);
m_service.signRequest(m_accessToken, request);
Since I added the debug() tag to the ServiceBuilder I get the following output:
signing request: URL
setting token to: Token[xxxx , xxxxx]
generating signature...
thats it.. nothing else happens, the code just seems to die there.
I tried to catch Exception from the m_service call but it does not throw exception.
I had tried this code before on a different Windows machine with Jetty and it worked but I dont have access to that machine or OS anymore..
What could I be doing wrong? Is there anything else I can do to get more debug output?
-Wish
Turns out that I needed to include the apache codec jar files in Tomcat.
I did go back to try my app on Jetty again under Windows, that worked without the codec. I am not entirely sure why linux+Tomcat needs apache codec while Jetty+Windows7 does not..
If I had Maven would not have this issue..