Problems & Solutions - SingletonTheory/SingletonTheory.github.io GitHub Wiki

Problems & Solutions

Description

This page outlines some issues that was picked up during the development with their solutions. Simple, short & precise.

Message Size Limit Issue (ASP.Net)

Problem

When using ServiceStack's JSONServiceClient an issue came up where the max size limit of messages was hit. The exact message returned was as follows:

"The underlying connection was closed: The message length limit was exceeded"

Solution

Add the following items to the web.config file:

	<system.web>
		<httpRuntime maxRequestLength="1048576" />
	</system.web>
	<system.webServer>
		<security>
			<requestFiltering>
				<requestLimits maxAllowedContentLength="1073741824" />
			</requestFiltering>
		</security>
	</system.webServer>

Message Size Limit Issue (Nginx)

Problem

When doing GET requests against Nginx an issue came up where the max size limit of messages was hit. The exact message returned was as follows:

"upstream sent too big header while reading response header from upstream"

Solution

Add the following items to the nginx.conf file under the http section:

    proxy_buffer_size	128k;
    proxy_buffers	4 256k;
    proxy_busy_buffers_size	256k;

Recursive Loop Issue - HTML5Mode (AngularJS)

Problem

When putting your AngularJS app in HTML 5 mode with the following lines in your app.js, you might get an endless loop, causing all kinds of issues.

    $locationProvider.html5Mode(true);
    $locationProvider.hashPrefix('!');

Solution

Change the base href in the index.html header to:

    <base href="/" />

Remove the $locationProvider.hashPrefix('!'); in your app.js

Further Documentation

http://stackoverflow.com/questions/18214835/angularjs-how-to-enable-locationprovider-html5mode-with-deeplinking

AngularJS Deep Linking & Refresh (AngularJS)

Problem

If you have deep links in your application like: /auth/authadmin/roleadmin, you might find that you get a number of obscure issues when you refresh the page. The errors might include as follows:

    Uncaught SyntaxError: Unexpected token < 

or

    Resource interpreted as Script but transferred with MIME type text/html: ""

Solution

Change/Add the base href in the index.html header as:

    <base href="/" />

Further Documentation

http://stackoverflow.com/questions/17485627/angular-js-deep-linking-routeprovider-reload-not-working

AngularJS & Bootstrap Tabs

Problem

When setting up a Bootstrap Tab as in the documentation, Angular uses the href and tries to route accordingly. This has the negative effect of you not being able to see the tab.

Solution

When using the Bootstrap 3 Tabs, simply add target="_self" the following to your anchor as follows:

    <a data-toggle="tab" href="#panel_overview" target="_self">Overview</a>

This allows the Bootstrap items to do what they want to do and you to use the default functionality as intended. No JavaScript needed.

Further Documentation

AngularJS Docs: http://docs.angularjs.org/guide/dev_guide.services.$location Forum: https://groups.google.com/forum/#!topic/angular/yKv8jXYBsBI

⚠️ **GitHub.com Fallback** ⚠️