Configuration of envoy routes and minor code fixes

This commit is contained in:
eiximenis 2019-09-19 18:26:04 +02:00
parent 9b57122f7a
commit d68c9e40aa
43 changed files with 204 additions and 88 deletions

View File

@ -133,8 +133,8 @@ ExecKube -cmd 'create -f services.yaml'
ExecKube -cmd 'create -f internalurls.yaml' ExecKube -cmd 'create -f internalurls.yaml'
ExecKube -cmd 'create configmap urls ` ExecKube -cmd 'create configmap urls `
--from-literal=PicBaseUrl=http://$($externalDns)/webshoppingapigw/api/v1/c/catalog/items/[0]/pic/ ` --from-literal=PicBaseUrl=http://$($externalDns)/webshoppingapigw/c/api/v1/catalog/items/[0]/pic/ `
--from-literal=Marketing_PicBaseUrl=http://$($externalDns)/webmarketingapigw/api/v1/m/campaigns/[0]/pic/ ` --from-literal=Marketing_PicBaseUrl=http://$($externalDns)/webmarketingapigw/m/api/v1/campaigns/[0]/pic/ `
--from-literal=mvc_e=http://$($externalDns)/webmvc ` --from-literal=mvc_e=http://$($externalDns)/webmvc `
--from-literal=marketingapigw_e=http://$($externalDns)/webmarketingapigw ` --from-literal=marketingapigw_e=http://$($externalDns)/webmarketingapigw `
--from-literal=webshoppingapigw_e=http://$($externalDns)/webshoppingapigw ` --from-literal=webshoppingapigw_e=http://$($externalDns)/webshoppingapigw `

View File

@ -24,9 +24,13 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/m/" prefix: "/m/"
route:
prefix_rewrite: "/marketing-api/"
cluster: marketing
- match:
prefix: "/marketing-api/"
route: route:
prefix_rewrite: "/api/v1/"
cluster: marketing cluster: marketing
http_filters: http_filters:
- name: envoy.router - name: envoy.router

View File

@ -12,7 +12,9 @@ service:
ingress: ingress:
enabled: true enabled: true
annotations: {} annotations:
nginx.ingress.kubernetes.io/rewrite-target: "/"
ingress.kubernetes.io/rewrite-target: "/"
tls: [] tls: []
resources: {} resources: {}

View File

@ -24,20 +24,32 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/c/" prefix: "/c/"
route: route:
prefix_rewrite: "/api/v1/" prefix_rewrite: "/catalog-api/"
cluster: catalog cluster: catalog
- match: - match:
prefix: "/api/v1/o/" prefix: "/catalog-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/o/"
route:
prefix_rewrite: "/order-api/"
cluster: ordering cluster: ordering
- match: - match:
prefix: "/api/v1/b/" prefix: "/order-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/b/"
route:
prefix_rewrite: "/basket-api/"
cluster: basket cluster: basket
- match:
prefix: "/basket-api/"
route:
cluster: basket
- match: - match:
prefix: "/" prefix: "/"
route: route:

View File

@ -12,7 +12,9 @@ service:
ingress: ingress:
enabled: true enabled: true
annotations: {} annotations:
nginx.ingress.kubernetes.io/rewrite-target: "/"
ingress.kubernetes.io/rewrite-target: "/"
tls: [] tls: []
resources: {} resources: {}

View File

@ -24,9 +24,13 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/m/" prefix: "/m/"
route:
prefix_rewrite: "/marketing-api/"
cluster: marketing
- match:
prefix: "/marketing-api/"
route: route:
prefix_rewrite: "/api/v1/"
cluster: marketing cluster: marketing
http_filters: http_filters:
- name: envoy.router - name: envoy.router

View File

@ -12,7 +12,9 @@ service:
ingress: ingress:
enabled: true enabled: true
annotations: {} annotations:
nginx.ingress.kubernetes.io/rewrite-target: "/"
ingress.kubernetes.io/rewrite-target: "/"
tls: [] tls: []
resources: {} resources: {}

View File

@ -24,20 +24,32 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/c/" prefix: "/c/"
route: route:
prefix_rewrite: "/api/v1/" prefix_rewrite: "/catalog-api/"
cluster: catalog cluster: catalog
- match: - match:
prefix: "/api/v1/o/" prefix: "/catalog-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/o/"
route:
prefix_rewrite: "/order-api/"
cluster: ordering cluster: ordering
- match: - match:
prefix: "/api/v1/b/" prefix: "/order-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/b/"
route:
prefix_rewrite: "/basket-api/"
cluster: basket cluster: basket
- match:
prefix: "/basket-api/"
route:
cluster: basket
- match: - match:
prefix: "/" prefix: "/"
route: route:

View File

@ -12,7 +12,9 @@ service:
ingress: ingress:
enabled: true enabled: true
annotations: {} annotations:
nginx.ingress.kubernetes.io/rewrite-target: "/"
ingress.kubernetes.io/rewrite-target: "/"
tls: [] tls: []
resources: {} resources: {}

View File

@ -13,7 +13,7 @@ metadata:
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
data: data:
catalog__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.catalog.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; catalog__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.catalog.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
catalog__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ catalog__PicBaseUrl: http://{{ $webshoppingapigw }}/c/api/v1/catalog/items/[0]/pic/
catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}" catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}"
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"

View File

@ -83,11 +83,11 @@ if ($deployCharts) {
if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) { if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) {
Write-Host "Installing: $chart" -ForegroundColor Green Write-Host "Installing: $chart" -ForegroundColor Green
if ($useCustomRegistry) { if ($useCustomRegistry) {
helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" --set image.tag=$imageTag --set image.pullPolicy=$imagePullPolicy --set inf.mesh.enabled=$useMesh --name="$appName-$chart" $chart helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" --set image.tag=$imageTag --set image.pullPolicy=$imagePullPolicy --set inf.mesh.enabled=$useMesh --set inf.k8s.local=$useLocalk8s --name="$appName-$chart" $chart
} }
else { else {
if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" --set image.tag=$imageTag --set image.pullPolicy=$imagePullPolicy --set inf.mesh.enabled=$useMesh --name="$appName-$chart" $chart helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" --set image.tag=$imageTag --set image.pullPolicy=$imagePullPolicy --set inf.mesh.enabled=$useMesh --set inf.k8s.local=$useLocalk8s --name="$appName-$chart" $chart
} }
} }
} }

View File

@ -0,0 +1,28 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.inf.k8s.local -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.identity }}
{{- $name := include "identity-api.fullname" . -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $name }}-local
labels:
app: {{ template "identity-api.name" . }}
chart: {{ template "identity-api.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
rules:
- http:
paths:
- backend:
serviceName: {{ $serviceName }}
servicePort: http
path: {{ $ingressPath }}
{{- end -}}
{{- end -}}

View File

@ -41,6 +41,7 @@ inf:
key: "" # App insights to use key: "" # App insights to use
k8s: # inf.k8s defines Kubernetes cluster global config k8s: # inf.k8s defines Kubernetes cluster global config
dns: "" # k8s external DNS. This value or ip value MUST BE PROVIDED dns: "" # k8s external DNS. This value or ip value MUST BE PROVIDED
local: false # True when deploying on "local K8s" provided by Docker Desktop.
misc: # inf.misc contains miscellaneous configuration related to infrastructure misc: # inf.misc contains miscellaneous configuration related to infrastructure
useLoadTest: false # If running under loading test or not useLoadTest: false # If running under loading test or not
useAzureStorage: false # If catalog api uses azure storage or not useAzureStorage: false # If catalog api uses azure storage or not

View File

@ -1,3 +1,5 @@
# This file contains common annotations when using AKS with Http Application Routing
ingress: ingress:
annotations: annotations:
kubernetes.io/ingress.class: addon-http-application-routing kubernetes.io/ingress.class: addon-http-application-routing

View File

@ -1,3 +1,5 @@
# This file contains common ingress annotations when using Kubernetes included in Docker Desktop
ingress: ingress:
annotations: annotations:
kubernetes.io/ingress.class: "nginx" kubernetes.io/ingress.class: "nginx"

View File

@ -173,7 +173,7 @@ The file `inf.yaml` contains the description of the infrastructure used. File is
Using Azure storage for catalog (and marketing) photos is not directly supported, but you can accomplish it by editing the file `k8s/helm/catalog-api/templates/configmap.yaml`. Search for lines: Using Azure storage for catalog (and marketing) photos is not directly supported, but you can accomplish it by editing the file `k8s/helm/catalog-api/templates/configmap.yaml`. Search for lines:
``` ```
catalog__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ catalog__PicBaseUrl: http://{{ $webshoppingapigw }}/c/api/v1/catalog/items/[0]/pic/
``` ```
And replace it for: And replace it for:
@ -185,7 +185,7 @@ catalog__PicBaseUrl: http://<url-of-the-storage>/
In the same way, to use Azure storage for the marketing service, have to edit the file `k8s/helm/marketing-api/templates/configmap.yaml` and replacing the line: In the same way, to use Azure storage for the marketing service, have to edit the file `k8s/helm/marketing-api/templates/configmap.yaml` and replacing the line:
``` ```
marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/c/api/v1/catalog/items/[0]/pic/
``` ```
by: by:

View File

@ -23,4 +23,4 @@ data:
marketing__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.marketing.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; marketing__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.marketing.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
marketing__MongoConnectionString: mongodb://{{ $mongo }} marketing__MongoConnectionString: mongodb://{{ $mongo }}
marketing__MongoDatabase: {{ .Values.inf.mongo.marketing.database }} marketing__MongoDatabase: {{ .Values.inf.mongo.marketing.database }}
marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/c/api/v1/catalog/items/[0]/pic/

View File

@ -3,7 +3,6 @@
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} {{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
{{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}} {{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:

View File

@ -0,0 +1,28 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.inf.k8s.local -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mvc }}
{{- $name := include "webmvc.fullname" . -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $name }}-local
labels:
app: {{ template "webmvc.name" . }}
chart: {{ template "webmvc.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
rules:
- http:
paths:
- backend:
serviceName: {{ $serviceName }}
servicePort: http
path: {{ $ingressPath }}
{{- end -}}
{{- end -}}

View File

@ -24,9 +24,13 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/m/" prefix: "/m/"
route:
prefix_rewrite: "/marketing-api/"
cluster: marketing
- match:
prefix: "/marketing-api/"
route: route:
prefix_rewrite: "/api/v1/"
cluster: marketing cluster: marketing
http_filters: http_filters:
- name: envoy.router - name: envoy.router

View File

@ -24,20 +24,32 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/c/" prefix: "/c/"
route: route:
prefix_rewrite: "/api/v1/" prefix_rewrite: "/catalog-api/"
cluster: catalog cluster: catalog
- match: - match:
prefix: "/api/v1/o/" prefix: "/catalog-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/o/"
route:
prefix_rewrite: "/order-api/"
cluster: ordering cluster: ordering
- match: - match:
prefix: "/api/v1/b/" prefix: "/order-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/b/"
route:
prefix_rewrite: "/basket-api/"
cluster: basket cluster: basket
- match:
prefix: "/basket-api/"
route:
cluster: basket
- match: - match:
prefix: "/" prefix: "/"
route: route:

View File

@ -24,9 +24,13 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/m/" prefix: "/m/"
route:
prefix_rewrite: "/marketing-api/"
cluster: marketing
- match:
prefix: "/marketing-api/"
route: route:
prefix_rewrite: "/api/v1/"
cluster: marketing cluster: marketing
http_filters: http_filters:
- name: envoy.router - name: envoy.router

View File

@ -24,20 +24,32 @@ static_resources:
- "*" - "*"
routes: routes:
- match: - match:
prefix: "/api/v1/c/" prefix: "/c/"
route: route:
prefix_rewrite: "/api/v1/" prefix_rewrite: "/catalog-api/"
cluster: catalog cluster: catalog
- match: - match:
prefix: "/api/v1/o/" prefix: "/catalog-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/o/"
route:
prefix_rewrite: "/order-api/"
cluster: ordering cluster: ordering
- match: - match:
prefix: "/api/v1/b/" prefix: "/order-api/"
route: route:
prefix_rewrite: "/api/v1/" cluster: catalog
- match:
prefix: "/b/"
route:
prefix_rewrite: "/basket-api/"
cluster: basket cluster: basket
- match:
prefix: "/basket-api/"
route:
cluster: basket
- match: - match:
prefix: "/" prefix: "/"
route: route:

View File

@ -66,14 +66,9 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
app.UseHttpsRedirection();
app.UseSwagger().UseSwaggerUI(c => app.UseSwagger().UseSwaggerUI(c =>
{ {

View File

@ -67,11 +67,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");
app.UseHttpsRedirection(); app.UseHttpsRedirection();

View File

@ -12,7 +12,7 @@ namespace eShopOnContainers.Core.Services.Basket
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private readonly IFixUriService _fixUriService; private readonly IFixUriService _fixUriService;
private const string ApiUrlBase = "api/v1/b/basket"; private const string ApiUrlBase = "b/api/v1/basket";
public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService) public BasketService(IRequestProvider requestProvider, IFixUriService fixUriService)
{ {

View File

@ -15,7 +15,7 @@ namespace eShopOnContainers.Core.Services.Catalog
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private readonly IFixUriService _fixUriService; private readonly IFixUriService _fixUriService;
private const string ApiUrlBase = "api/v1/c/catalog"; private const string ApiUrlBase = "c/api/v1/catalog";
public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService) public CatalogService(IRequestProvider requestProvider, IFixUriService fixUriService)
{ {

View File

@ -14,7 +14,7 @@ namespace eShopOnContainers.Core.Services.Marketing
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private readonly IFixUriService _fixUriService; private readonly IFixUriService _fixUriService;
private const string ApiUrlBase = "api/v1/m/campaigns"; private const string ApiUrlBase = "m/api/v1/campaigns";
public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService) public CampaignService(IRequestProvider requestProvider, IFixUriService fixUriService)
{ {

View File

@ -12,7 +12,7 @@ namespace eShopOnContainers.Core.Services.Order
{ {
private readonly IRequestProvider _requestProvider; private readonly IRequestProvider _requestProvider;
private const string ApiUrlBase = "api/v1/o/orders"; private const string ApiUrlBase = "o/api/v1/orders";
public OrderService(IRequestProvider requestProvider) public OrderService(IRequestProvider requestProvider)
{ {

View File

@ -153,7 +153,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
app.UseForwardedHeaders(); app.UseForwardedHeaders();
// Adds IdentityServer // Adds IdentityServer
app.UseIdentityServer(); app.UseIdentityServer();
app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {

View File

@ -27,7 +27,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
_settings = settings; _settings = settings;
_logger =logger; _logger =logger;
_basketByPassUrl = $"{_settings.Value.PurchaseUrl}/api/v1/b/basket"; _basketByPassUrl = $"{_settings.Value.PurchaseUrl}/b/api/v1/basket";
_purchaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1"; _purchaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1";
} }

View File

@ -21,7 +21,7 @@
_httpClient = httpClient; _httpClient = httpClient;
_logger = logger; _logger = logger;
_remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/api/v1/m/campaigns/"; _remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/m/api/v1/campaigns/";
} }
public async Task<Campaign> GetCampaigns(int pageSize, int pageIndex) public async Task<Campaign> GetCampaigns(int pageSize, int pageIndex)

View File

@ -25,7 +25,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
_settings = settings; _settings = settings;
_logger = logger; _logger = logger;
_remoteServiceBaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1/c/catalog/"; _remoteServiceBaseUrl = $"{_settings.Value.PurchaseUrl}/c/api/v1/catalog/";
} }
public async Task<Catalog> GetCatalogItems(int page, int take, int? brand, int? type) public async Task<Catalog> GetCatalogItems(int page, int take, int? brand, int? type)

View File

@ -22,7 +22,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
_httpClient = httpClient; _httpClient = httpClient;
_settings = settings; _settings = settings;
_remoteServiceBaseUrl = $"{settings.Value.PurchaseUrl}/api/v1/o/orders"; _remoteServiceBaseUrl = $"{settings.Value.PurchaseUrl}/o/api/v1/orders";
} }
async public Task<Order> GetOrder(ApplicationUser user, string id) async public Task<Order> GetOrder(ApplicationUser user, string id)

View File

@ -14,6 +14,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging;
using Polly; using Polly;
using Polly.Extensions.Http; using Polly.Extensions.Http;
using StackExchange.Redis; using StackExchange.Redis;
@ -46,7 +47,9 @@ namespace Microsoft.eShopOnContainers.WebMVC
.AddDevspaces() .AddDevspaces()
.AddHttpClientServices(Configuration); .AddHttpClientServices(Configuration);
//.AddHttpClientLogging(Configuration) //Opt-in HttpClientLogging config //.AddHttpClientLogging(Configuration) //Opt-in HttpClientLogging config
IdentityModelEventSource.ShowPII = true; // Caution! Do NOT use in production: https://aka.ms/IdentityModel/PII
services.AddControllers(); services.AddControllers();
services.AddCustomAuthentication(Configuration); services.AddCustomAuthentication(Configuration);
@ -66,7 +69,6 @@ namespace Microsoft.eShopOnContainers.WebMVC
else else
{ {
app.UseExceptionHandler("/Error"); app.UseExceptionHandler("/Error");
app.UseHsts();
} }
var pathBase = Configuration["PATH_BASE"]; var pathBase = Configuration["PATH_BASE"];
@ -87,7 +89,6 @@ namespace Microsoft.eShopOnContainers.WebMVC
WebContextSeed.Seed(app, env, loggerFactory); WebContextSeed.Seed(app, env, loggerFactory);
app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseAuthentication(); app.UseAuthentication();

View File

@ -68,7 +68,7 @@ export class BasketService {
} }
setBasketCheckout(basketCheckout): Observable<boolean> { setBasketCheckout(basketCheckout): Observable<boolean> {
let url = this.basketUrl + '/api/v1/b/basket/checkout'; let url = this.basketUrl + '/b/api/v1/basket/checkout';
return this.service.postWithId(url, basketCheckout).pipe(map((response: any) => { return this.service.postWithId(url, basketCheckout).pipe(map((response: any) => {
this.basketEvents.orderCreated(); this.basketEvents.orderCreated();
return true; return true;
@ -76,7 +76,7 @@ export class BasketService {
} }
getBasket(): Observable<IBasket> { getBasket(): Observable<IBasket> {
let url = this.basketUrl + '/api/v1/b/basket/' + this.basket.buyerId; let url = this.basketUrl + '/b/api/v1/basket/' + this.basket.buyerId;
return this.service.get(url).pipe(map((response: any) => { return this.service.get(url).pipe(map((response: any) => {
if (response.status === 204) { if (response.status === 204) {
return null; return null;

View File

@ -29,7 +29,7 @@ export class CampaignsService {
} }
getCampaigns(pageIndex: number, pageSize: number): Observable<ICampaign> { getCampaigns(pageIndex: number, pageSize: number): Observable<ICampaign> {
let url = this.marketingUrl + '/api/v1/m/campaigns/user'; let url = this.marketingUrl + '/m/api/v1/campaigns/user';
url = url + '?pageIndex=' + pageIndex + '&pageSize=' + pageSize; url = url + '?pageIndex=' + pageIndex + '&pageSize=' + pageSize;
return this.service.get(url).pipe(map((response: any) => { return this.service.get(url).pipe(map((response: any) => {
@ -38,7 +38,7 @@ export class CampaignsService {
} }
getCampaign(id: number): Observable<ICampaignItem> { getCampaign(id: number): Observable<ICampaignItem> {
let url = this.marketingUrl + '/api/v1/m/campaigns/' + id; let url = this.marketingUrl + '/m/api/v1/campaigns/' + id;
return this.service.get(url).pipe(map((response: any) => { return this.service.get(url).pipe(map((response: any) => {
return response; return response;

View File

@ -18,9 +18,9 @@ export class CatalogService {
constructor(private service: DataService, private configurationService: ConfigurationService) { constructor(private service: DataService, private configurationService: ConfigurationService) {
this.configurationService.settingsLoaded$.subscribe(x => { this.configurationService.settingsLoaded$.subscribe(x => {
this.catalogUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/items'; this.catalogUrl = this.configurationService.serverSettings.purchaseUrl + '/c/api/v1/catalog/items';
this.brandUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/catalogbrands'; this.brandUrl = this.configurationService.serverSettings.purchaseUrl + '/c/api/v1/catalog/catalogbrands';
this.typesUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/catalogtypes'; this.typesUrl = this.configurationService.serverSettings.purchaseUrl + '/c/api/v1/catalog/catalogtypes';
}); });
} }

View File

@ -25,7 +25,7 @@ export class OrdersService {
} }
getOrders(): Observable<IOrder[]> { getOrders(): Observable<IOrder[]> {
let url = this.ordersUrl + '/api/v1/o/orders'; let url = this.ordersUrl + '/o/api/v1/orders';
return this.service.get(url).pipe(map((response: any) => { return this.service.get(url).pipe(map((response: any) => {
return response; return response;
@ -33,7 +33,7 @@ export class OrdersService {
} }
getOrder(id: number): Observable<IOrderDetail> { getOrder(id: number): Observable<IOrderDetail> {
let url = this.ordersUrl + '/api/v1/o/orders/' + id; let url = this.ordersUrl + '/o/api/v1/orders/' + id;
return this.service.get(url).pipe(map((response: any) => { return this.service.get(url).pipe(map((response: any) => {
return response; return response;

View File

@ -69,11 +69,7 @@ namespace eShopConContainers.WebSPA
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
// Configure XSRF middleware, This pattern is for SPA style applications where XSRF token is added on Index page // Configure XSRF middleware, This pattern is for SPA style applications where XSRF token is added on Index page
// load and passed back token on every subsequent async request // load and passed back token on every subsequent async request
// app.Use(async (context, next) => // app.Use(async (context, next) =>

View File

@ -47,8 +47,6 @@ namespace WebStatus
else else
{ {
app.UseExceptionHandler("/Home/Error"); app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
} }
var pathBase = Configuration["PATH_BASE"]; var pathBase = Configuration["PATH_BASE"];
@ -65,7 +63,6 @@ namespace WebStatus
app.UseStaticFiles(); app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {

View File

@ -90,7 +90,7 @@ services:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/api/v1/c/catalog/items/[0]/pic/} - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/c/api/v1/catalog/items/[0]/pic/}
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test} - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
@ -114,7 +114,7 @@ services:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql-data-test;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/api/v1/c/catalog/items/[0]/pic/} - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/c/api/v1/catalog/items/[0]/pic/}
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test} - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq-test}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}

View File

@ -78,7 +78,7 @@ services:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/api/v1/c/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/c/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}