I am using angular 9, the issue I am facing on production is that, when ever I refresh page on browser it goes to https://subdomain.example.com/orders from http://subdomain.example.com/orders . I do not want to use ssl for subdomain. This issue is happening only for urls that point to OrdersModule and ShipmentsModule.
What am I missing here?
app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { AuthGuard } from './authguard';
import { CalendarComponent } from './calendar/calendar.component';
import { CouponsComponent } from './coupons/coupons.component';
const routes: Routes = [
{ path: 'login', component: LoginComponent },
{ path: 'orders', loadChildren: () => import('./orders/orders.module').then(m => m.OrdersModule), canActivate: [AuthGuard]},
{ path: 'calendar', component: CalendarComponent, canActivate: [AuthGuard] },
{ path: 'coupons', component: CouponsComponent, canActivate: [AuthGuard] },
{ path: 'shipments', loadChildren: () => import('./shipments/shipments.module').then(m => m.ShipmentsModule), canActivate: [AuthGuard] },
{ path: '', component: DashboardComponent, canActivate: [AuthGuard] },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
shipments-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ShipmentsComponent } from './shipments.component';
import {ShipmentsAddComponent} from './shipments-add/shipments-add.component';
const routes: Routes = [
{ path: '', component: ShipmentsComponent },
{ path: 'add', component: ShipmentsAddComponent },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ShipmentsRoutingModule { }
.htaccess RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /index.html
The issue was Strict-Transport-Security it was true for all subdomains.
Adding line below to main domain's .htaccess file solved the issue
Header always unset Strict-Transport-Security
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.