@martin_nuc
REST calls
html, css, js
$rootScope.$on '$stateChangeStart', (event, toState, toParams) ->
switch (toState.name)
when 'marketplace.loan.list'
window.location = ENV.zonkyAppUrl
event.preventDefault()
when 'marketplace.loan.detail'
return if (toParams.edit) # exception for story edit
window.location = "#{ENV.zonkyAppUrl}/#/marketplace/detail/#{toParams.pk}"
event.preventDefault()
HAProxy
backend app
balance roundrobin
option httplog
cookie SRVNAME insert
http-request set-header Host cdn.zonky.cz
server ember cdn.zonky.cz:443 weight 10 ssl verify none cookie S2 sni str(cdn.zonky.cz)
server angular 77.78.99.121:443 check weight 90 ssl verify none cookie S1
option forwardfor header x-zonky-client-ip
const routes: Routes = [
...,
{
path: '**',
component: IFrameComponent
}
];
// .html
<iframe [attr.src]="url"></iframe>
// .ts
let counter = 0;
this.route.url.subscribe(urlSegments => {
this.counter += 1;
const requestedUrl = '/legacy/index.html?counter=' + this.counter
+ '#/' + urlSegments.join('/');
this.url = this.sanitizer.bypassSecurityTrustResourceUrl(requestedUrl);
});
if (window.self !== window.top) {
$urlRouterProvider.otherwise(($injector, $location) => {
const path = $location.path();
window.parent.postMessage({navigateTo: path}, "*");
});
} else {
$urlRouterProvider.otherwise('/');
}