diff --git a/k8s/deploy.ps1 b/k8s/deploy.ps1 index abeb12aed..6a44a4b12 100644 --- a/k8s/deploy.ps1 +++ b/k8s/deploy.ps1 @@ -133,8 +133,8 @@ ExecKube -cmd 'create -f services.yaml' ExecKube -cmd 'create -f internalurls.yaml' ExecKube -cmd 'create configmap urls ` - --from-literal=PicBaseUrl=http://$($externalDns)/webshoppingapigw/api/v1/c/catalog/items/[0]/pic/ ` - --from-literal=Marketing_PicBaseUrl=http://$($externalDns)/webmarketingapigw/api/v1/m/campaigns/[0]/pic/ ` + --from-literal=PicBaseUrl=http://$($externalDns)/webshoppingapigw/c/api/v1/catalog/items/[0]/pic/ ` + --from-literal=Marketing_PicBaseUrl=http://$($externalDns)/webmarketingapigw/m/api/v1/campaigns/[0]/pic/ ` --from-literal=mvc_e=http://$($externalDns)/webmvc ` --from-literal=marketingapigw_e=http://$($externalDns)/webmarketingapigw ` --from-literal=webshoppingapigw_e=http://$($externalDns)/webshoppingapigw ` diff --git a/k8s/helm/apigwmm/envoy.yaml b/k8s/helm/apigwmm/envoy.yaml index a33d276a0..324d903ab 100644 --- a/k8s/helm/apigwmm/envoy.yaml +++ b/k8s/helm/apigwmm/envoy.yaml @@ -24,9 +24,13 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/m/" + prefix: "/m/" + route: + prefix_rewrite: "/marketing-api/" + cluster: marketing + - match: + prefix: "/marketing-api/" route: - prefix_rewrite: "/api/v1/" cluster: marketing http_filters: - name: envoy.router diff --git a/k8s/helm/apigwmm/values.yaml b/k8s/helm/apigwmm/values.yaml index 6d626d1d3..a3e7d8586 100644 --- a/k8s/helm/apigwmm/values.yaml +++ b/k8s/helm/apigwmm/values.yaml @@ -12,7 +12,9 @@ service: ingress: enabled: true - annotations: {} + annotations: + nginx.ingress.kubernetes.io/rewrite-target: "/" + ingress.kubernetes.io/rewrite-target: "/" tls: [] resources: {} diff --git a/k8s/helm/apigwms/envoy.yaml b/k8s/helm/apigwms/envoy.yaml index de8bd6058..483e97cb6 100644 --- a/k8s/helm/apigwms/envoy.yaml +++ b/k8s/helm/apigwms/envoy.yaml @@ -24,20 +24,32 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/c/" + prefix: "/c/" route: - prefix_rewrite: "/api/v1/" + prefix_rewrite: "/catalog-api/" cluster: catalog - match: - prefix: "/api/v1/o/" + prefix: "/catalog-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/o/" + route: + prefix_rewrite: "/order-api/" cluster: ordering - match: - prefix: "/api/v1/b/" + prefix: "/order-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/b/" + route: + prefix_rewrite: "/basket-api/" cluster: basket + - match: + prefix: "/basket-api/" + route: + cluster: basket - match: prefix: "/" route: diff --git a/k8s/helm/apigwms/values.yaml b/k8s/helm/apigwms/values.yaml index 376c469c7..1ec7bf1c9 100644 --- a/k8s/helm/apigwms/values.yaml +++ b/k8s/helm/apigwms/values.yaml @@ -12,7 +12,9 @@ service: ingress: enabled: true - annotations: {} + annotations: + nginx.ingress.kubernetes.io/rewrite-target: "/" + ingress.kubernetes.io/rewrite-target: "/" tls: [] resources: {} diff --git a/k8s/helm/apigwwm/envoy.yaml b/k8s/helm/apigwwm/envoy.yaml index a33d276a0..324d903ab 100644 --- a/k8s/helm/apigwwm/envoy.yaml +++ b/k8s/helm/apigwwm/envoy.yaml @@ -24,9 +24,13 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/m/" + prefix: "/m/" + route: + prefix_rewrite: "/marketing-api/" + cluster: marketing + - match: + prefix: "/marketing-api/" route: - prefix_rewrite: "/api/v1/" cluster: marketing http_filters: - name: envoy.router diff --git a/k8s/helm/apigwwm/values.yaml b/k8s/helm/apigwwm/values.yaml index 0f9f69ca4..9cfa3de16 100644 --- a/k8s/helm/apigwwm/values.yaml +++ b/k8s/helm/apigwwm/values.yaml @@ -12,7 +12,9 @@ service: ingress: enabled: true - annotations: {} + annotations: + nginx.ingress.kubernetes.io/rewrite-target: "/" + ingress.kubernetes.io/rewrite-target: "/" tls: [] resources: {} diff --git a/k8s/helm/apigwws/envoy.yaml b/k8s/helm/apigwws/envoy.yaml index de8bd6058..483e97cb6 100644 --- a/k8s/helm/apigwws/envoy.yaml +++ b/k8s/helm/apigwws/envoy.yaml @@ -24,20 +24,32 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/c/" + prefix: "/c/" route: - prefix_rewrite: "/api/v1/" + prefix_rewrite: "/catalog-api/" cluster: catalog - match: - prefix: "/api/v1/o/" + prefix: "/catalog-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/o/" + route: + prefix_rewrite: "/order-api/" cluster: ordering - match: - prefix: "/api/v1/b/" + prefix: "/order-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/b/" + route: + prefix_rewrite: "/basket-api/" cluster: basket + - match: + prefix: "/basket-api/" + route: + cluster: basket - match: prefix: "/" route: diff --git a/k8s/helm/apigwws/values.yaml b/k8s/helm/apigwws/values.yaml index 63fd70069..3e9ab8a7e 100644 --- a/k8s/helm/apigwws/values.yaml +++ b/k8s/helm/apigwws/values.yaml @@ -12,7 +12,9 @@ service: ingress: enabled: true - annotations: {} + annotations: + nginx.ingress.kubernetes.io/rewrite-target: "/" + ingress.kubernetes.io/rewrite-target: "/" tls: [] resources: {} diff --git a/k8s/helm/catalog-api/templates/configmap.yaml b/k8s/helm/catalog-api/templates/configmap.yaml index 902b65f5c..d85929080 100644 --- a/k8s/helm/catalog-api/templates/configmap.yaml +++ b/k8s/helm/catalog-api/templates/configmap.yaml @@ -13,7 +13,7 @@ metadata: heritage: {{ .Release.Service }} 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__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 }}" all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" diff --git a/k8s/helm/deploy-all.ps1 b/k8s/helm/deploy-all.ps1 index e401a0b63..66f9ac3b3 100644 --- a/k8s/helm/deploy-all.ps1 +++ b/k8s/helm/deploy-all.ps1 @@ -83,11 +83,11 @@ if ($deployCharts) { if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) { Write-Host "Installing: $chart" -ForegroundColor Green 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 { 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 } } } diff --git a/k8s/helm/identity-api/templates/ingress-dockerk8s.yaml b/k8s/helm/identity-api/templates/ingress-dockerk8s.yaml new file mode 100644 index 000000000..bcc47f1e4 --- /dev/null +++ b/k8s/helm/identity-api/templates/ingress-dockerk8s.yaml @@ -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 -}} \ No newline at end of file diff --git a/k8s/helm/inf.yaml b/k8s/helm/inf.yaml index 924027cbb..073233ad7 100644 --- a/k8s/helm/inf.yaml +++ b/k8s/helm/inf.yaml @@ -41,6 +41,7 @@ inf: key: "" # App insights to use k8s: # inf.k8s defines Kubernetes cluster global config 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 useLoadTest: false # If running under loading test or not useAzureStorage: false # If catalog api uses azure storage or not diff --git a/k8s/helm/ingress_values.yaml b/k8s/helm/ingress_values.yaml index 88540574d..31577e260 100644 --- a/k8s/helm/ingress_values.yaml +++ b/k8s/helm/ingress_values.yaml @@ -1,3 +1,5 @@ +# This file contains common annotations when using AKS with Http Application Routing + ingress: annotations: kubernetes.io/ingress.class: addon-http-application-routing diff --git a/k8s/helm/ingress_values_dockerk8s.yaml b/k8s/helm/ingress_values_dockerk8s.yaml index 75597aac9..f69af8a5b 100644 --- a/k8s/helm/ingress_values_dockerk8s.yaml +++ b/k8s/helm/ingress_values_dockerk8s.yaml @@ -1,3 +1,5 @@ +# This file contains common ingress annotations when using Kubernetes included in Docker Desktop + ingress: annotations: kubernetes.io/ingress.class: "nginx" diff --git a/k8s/helm/istio/doc.md b/k8s/helm/istio/doc.md index b8c0a0257..5694fe30b 100644 --- a/k8s/helm/istio/doc.md +++ b/k8s/helm/istio/doc.md @@ -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: ``` -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: @@ -185,7 +185,7 @@ catalog__PicBaseUrl: http:/// 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: diff --git a/k8s/helm/marketing-api/templates/configmap.yaml b/k8s/helm/marketing-api/templates/configmap.yaml index 123b21adf..aa68f3003 100644 --- a/k8s/helm/marketing-api/templates/configmap.yaml +++ b/k8s/helm/marketing-api/templates/configmap.yaml @@ -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__MongoConnectionString: mongodb://{{ $mongo }} marketing__MongoDatabase: {{ .Values.inf.mongo.marketing.database }} - marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ \ No newline at end of file + marketing__PicBaseUrl: http://{{ $webshoppingapigw }}/c/api/v1/catalog/items/[0]/pic/ \ No newline at end of file diff --git a/k8s/helm/webmvc/templates/configmap.yaml b/k8s/helm/webmvc/templates/configmap.yaml index 32df69fd0..ac94f5194 100644 --- a/k8s/helm/webmvc/templates/configmap.yaml +++ b/k8s/helm/webmvc/templates/configmap.yaml @@ -3,7 +3,6 @@ {{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} {{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}} - apiVersion: v1 kind: ConfigMap metadata: diff --git a/k8s/helm/webmvc/templates/ingress-dockerk8s.yaml b/k8s/helm/webmvc/templates/ingress-dockerk8s.yaml new file mode 100644 index 000000000..385369a7f --- /dev/null +++ b/k8s/helm/webmvc/templates/ingress-dockerk8s.yaml @@ -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 -}} \ No newline at end of file diff --git a/src/ApiGateways/Envoy/config/mobilemarketing/envoy.yaml b/src/ApiGateways/Envoy/config/mobilemarketing/envoy.yaml index a33d276a0..324d903ab 100644 --- a/src/ApiGateways/Envoy/config/mobilemarketing/envoy.yaml +++ b/src/ApiGateways/Envoy/config/mobilemarketing/envoy.yaml @@ -24,9 +24,13 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/m/" + prefix: "/m/" + route: + prefix_rewrite: "/marketing-api/" + cluster: marketing + - match: + prefix: "/marketing-api/" route: - prefix_rewrite: "/api/v1/" cluster: marketing http_filters: - name: envoy.router diff --git a/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml b/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml index de8bd6058..483e97cb6 100644 --- a/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml +++ b/src/ApiGateways/Envoy/config/mobileshopping/envoy.yaml @@ -24,20 +24,32 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/c/" + prefix: "/c/" route: - prefix_rewrite: "/api/v1/" + prefix_rewrite: "/catalog-api/" cluster: catalog - match: - prefix: "/api/v1/o/" + prefix: "/catalog-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/o/" + route: + prefix_rewrite: "/order-api/" cluster: ordering - match: - prefix: "/api/v1/b/" + prefix: "/order-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/b/" + route: + prefix_rewrite: "/basket-api/" cluster: basket + - match: + prefix: "/basket-api/" + route: + cluster: basket - match: prefix: "/" route: diff --git a/src/ApiGateways/Envoy/config/webmarketing/envoy.yaml b/src/ApiGateways/Envoy/config/webmarketing/envoy.yaml index a33d276a0..324d903ab 100644 --- a/src/ApiGateways/Envoy/config/webmarketing/envoy.yaml +++ b/src/ApiGateways/Envoy/config/webmarketing/envoy.yaml @@ -24,9 +24,13 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/m/" + prefix: "/m/" + route: + prefix_rewrite: "/marketing-api/" + cluster: marketing + - match: + prefix: "/marketing-api/" route: - prefix_rewrite: "/api/v1/" cluster: marketing http_filters: - name: envoy.router diff --git a/src/ApiGateways/Envoy/config/webshopping/envoy.yaml b/src/ApiGateways/Envoy/config/webshopping/envoy.yaml index de8bd6058..483e97cb6 100644 --- a/src/ApiGateways/Envoy/config/webshopping/envoy.yaml +++ b/src/ApiGateways/Envoy/config/webshopping/envoy.yaml @@ -24,20 +24,32 @@ static_resources: - "*" routes: - match: - prefix: "/api/v1/c/" + prefix: "/c/" route: - prefix_rewrite: "/api/v1/" + prefix_rewrite: "/catalog-api/" cluster: catalog - match: - prefix: "/api/v1/o/" + prefix: "/catalog-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/o/" + route: + prefix_rewrite: "/order-api/" cluster: ordering - match: - prefix: "/api/v1/b/" + prefix: "/order-api/" route: - prefix_rewrite: "/api/v1/" + cluster: catalog + - match: + prefix: "/b/" + route: + prefix_rewrite: "/basket-api/" cluster: basket + - match: + prefix: "/basket-api/" + route: + cluster: basket - match: prefix: "/" route: diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs index f08514177..c467e01ac 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs @@ -66,14 +66,9 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator { 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.UseHttpsRedirection(); app.UseSwagger().UseSwaggerUI(c => { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs index e16c4197e..d0ef8af98 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs @@ -67,11 +67,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator { 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.UseHttpsRedirection(); diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs index 48814341b..87479d7d1 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketService.cs @@ -12,7 +12,7 @@ namespace eShopOnContainers.Core.Services.Basket private readonly IRequestProvider _requestProvider; 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) { diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs index a13c22cb8..b91119a1a 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogService.cs @@ -15,7 +15,7 @@ namespace eShopOnContainers.Core.Services.Catalog private readonly IRequestProvider _requestProvider; 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) { diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Marketing/CampaignService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Marketing/CampaignService.cs index 7ff7ae50d..1048d1b84 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Marketing/CampaignService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Marketing/CampaignService.cs @@ -14,7 +14,7 @@ namespace eShopOnContainers.Core.Services.Marketing private readonly IRequestProvider _requestProvider; 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) { diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs index 3447a21d2..ff3e52666 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderService.cs @@ -12,7 +12,7 @@ namespace eShopOnContainers.Core.Services.Order { private readonly IRequestProvider _requestProvider; - private const string ApiUrlBase = "api/v1/o/orders"; + private const string ApiUrlBase = "o/api/v1/orders"; public OrderService(IRequestProvider requestProvider) { diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index 3552bdaa1..feefbcee3 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -153,7 +153,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API app.UseForwardedHeaders(); // Adds IdentityServer app.UseIdentityServer(); - app.UseHttpsRedirection(); app.UseRouting(); app.UseEndpoints(endpoints => { diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs index e9f015e54..dee8fc781 100644 --- a/src/Web/WebMVC/Services/BasketService.cs +++ b/src/Web/WebMVC/Services/BasketService.cs @@ -27,7 +27,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services _settings = settings; _logger =logger; - _basketByPassUrl = $"{_settings.Value.PurchaseUrl}/api/v1/b/basket"; + _basketByPassUrl = $"{_settings.Value.PurchaseUrl}/b/api/v1/basket"; _purchaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1"; } diff --git a/src/Web/WebMVC/Services/CampaignService.cs b/src/Web/WebMVC/Services/CampaignService.cs index 6521fd4ae..d768c51fd 100644 --- a/src/Web/WebMVC/Services/CampaignService.cs +++ b/src/Web/WebMVC/Services/CampaignService.cs @@ -21,7 +21,7 @@ _httpClient = httpClient; _logger = logger; - _remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/api/v1/m/campaigns/"; + _remoteServiceBaseUrl = $"{_settings.Value.MarketingUrl}/m/api/v1/campaigns/"; } public async Task GetCampaigns(int pageSize, int pageIndex) diff --git a/src/Web/WebMVC/Services/CatalogService.cs b/src/Web/WebMVC/Services/CatalogService.cs index d4899b453..40d3644f4 100644 --- a/src/Web/WebMVC/Services/CatalogService.cs +++ b/src/Web/WebMVC/Services/CatalogService.cs @@ -25,7 +25,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services _settings = settings; _logger = logger; - _remoteServiceBaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1/c/catalog/"; + _remoteServiceBaseUrl = $"{_settings.Value.PurchaseUrl}/c/api/v1/catalog/"; } public async Task GetCatalogItems(int page, int take, int? brand, int? type) diff --git a/src/Web/WebMVC/Services/OrderingService.cs b/src/Web/WebMVC/Services/OrderingService.cs index 489946db5..b5ad13386 100644 --- a/src/Web/WebMVC/Services/OrderingService.cs +++ b/src/Web/WebMVC/Services/OrderingService.cs @@ -22,7 +22,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services _httpClient = httpClient; _settings = settings; - _remoteServiceBaseUrl = $"{settings.Value.PurchaseUrl}/api/v1/o/orders"; + _remoteServiceBaseUrl = $"{settings.Value.PurchaseUrl}/o/api/v1/orders"; } async public Task GetOrder(ApplicationUser user, string id) diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 6f9f8c99a..187e4e04d 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; +using Microsoft.IdentityModel.Logging; using Polly; using Polly.Extensions.Http; using StackExchange.Redis; @@ -46,7 +47,9 @@ namespace Microsoft.eShopOnContainers.WebMVC .AddDevspaces() .AddHttpClientServices(Configuration); //.AddHttpClientLogging(Configuration) //Opt-in HttpClientLogging config - + + IdentityModelEventSource.ShowPII = true; // Caution! Do NOT use in production: https://aka.ms/IdentityModel/PII + services.AddControllers(); services.AddCustomAuthentication(Configuration); @@ -66,7 +69,6 @@ namespace Microsoft.eShopOnContainers.WebMVC else { app.UseExceptionHandler("/Error"); - app.UseHsts(); } var pathBase = Configuration["PATH_BASE"]; @@ -87,7 +89,6 @@ namespace Microsoft.eShopOnContainers.WebMVC WebContextSeed.Seed(app, env, loggerFactory); - app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); diff --git a/src/Web/WebSPA/Client/modules/basket/basket.service.ts b/src/Web/WebSPA/Client/modules/basket/basket.service.ts index 5484f9620..171c745c1 100644 --- a/src/Web/WebSPA/Client/modules/basket/basket.service.ts +++ b/src/Web/WebSPA/Client/modules/basket/basket.service.ts @@ -68,7 +68,7 @@ export class BasketService { } setBasketCheckout(basketCheckout): Observable { - 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) => { this.basketEvents.orderCreated(); return true; @@ -76,7 +76,7 @@ export class BasketService { } getBasket(): Observable { - 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) => { if (response.status === 204) { return null; diff --git a/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts b/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts index 6014bf07a..87efa96b7 100644 --- a/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts +++ b/src/Web/WebSPA/Client/modules/campaigns/campaigns.service.ts @@ -29,7 +29,7 @@ export class CampaignsService { } getCampaigns(pageIndex: number, pageSize: number): Observable { - let url = this.marketingUrl + '/api/v1/m/campaigns/user'; + let url = this.marketingUrl + '/m/api/v1/campaigns/user'; url = url + '?pageIndex=' + pageIndex + '&pageSize=' + pageSize; return this.service.get(url).pipe(map((response: any) => { @@ -38,7 +38,7 @@ export class CampaignsService { } getCampaign(id: number): Observable { - 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 response; diff --git a/src/Web/WebSPA/Client/modules/catalog/catalog.service.ts b/src/Web/WebSPA/Client/modules/catalog/catalog.service.ts index 2054e0adf..186731543 100644 --- a/src/Web/WebSPA/Client/modules/catalog/catalog.service.ts +++ b/src/Web/WebSPA/Client/modules/catalog/catalog.service.ts @@ -18,9 +18,9 @@ export class CatalogService { constructor(private service: DataService, private configurationService: ConfigurationService) { this.configurationService.settingsLoaded$.subscribe(x => { - this.catalogUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/items'; - this.brandUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/catalogbrands'; - this.typesUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/catalogtypes'; + this.catalogUrl = this.configurationService.serverSettings.purchaseUrl + '/c/api/v1/catalog/items'; + this.brandUrl = this.configurationService.serverSettings.purchaseUrl + '/c/api/v1/catalog/catalogbrands'; + this.typesUrl = this.configurationService.serverSettings.purchaseUrl + '/c/api/v1/catalog/catalogtypes'; }); } diff --git a/src/Web/WebSPA/Client/modules/orders/orders.service.ts b/src/Web/WebSPA/Client/modules/orders/orders.service.ts index fc7ecd6f2..c7f27ee7d 100644 --- a/src/Web/WebSPA/Client/modules/orders/orders.service.ts +++ b/src/Web/WebSPA/Client/modules/orders/orders.service.ts @@ -25,7 +25,7 @@ export class OrdersService { } getOrders(): Observable { - 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 response; @@ -33,7 +33,7 @@ export class OrdersService { } getOrder(id: number): Observable { - 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 response; diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs index 48cfd121e..367d494ba 100644 --- a/src/Web/WebSPA/Startup.cs +++ b/src/Web/WebSPA/Startup.cs @@ -69,11 +69,7 @@ namespace eShopConContainers.WebSPA { 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 // load and passed back token on every subsequent async request // app.Use(async (context, next) => diff --git a/src/Web/WebStatus/Startup.cs b/src/Web/WebStatus/Startup.cs index 3dadeb842..c68239c32 100644 --- a/src/Web/WebStatus/Startup.cs +++ b/src/Web/WebStatus/Startup.cs @@ -47,8 +47,6 @@ namespace WebStatus else { 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"]; @@ -65,7 +63,6 @@ namespace WebStatus app.UseStaticFiles(); - app.UseHttpsRedirection(); app.UseRouting(); app.UseEndpoints(endpoints => { diff --git a/src/docker-compose-tests.override.yml b/src/docker-compose-tests.override.yml index 8705e703f..068f02e66 100644 --- a/src/docker-compose-tests.override.yml +++ b/src/docker-compose-tests.override.yml @@ -90,7 +90,7 @@ services: - ASPNETCORE_ENVIRONMENT=Development - 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} - - 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} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} @@ -114,7 +114,7 @@ services: - ASPNETCORE_ENVIRONMENT=Development - 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} - - 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} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index 5c7af1b31..a6fa6c483 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -78,7 +78,7 @@ services: environment: - ASPNETCORE_ENVIRONMENT=Development - 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} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}