Justin Kotalik
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
26 additions and
2 deletions
src/Microsoft.Tye.Hosting/HttpProxyService.cs
test/E2ETest/TyeRunTests.cs
test/E2ETest/testassets/generate/apps-with-ingress.1.18.yaml
test/E2ETest/testassets/generate/apps-with-ingress.1.19.yaml
test/E2ETest/testassets/projects/apps-with-ingress/ApplicationA/Startup.cs
test/E2ETest/testassets/projects/apps-with-ingress/tye.yaml
@ -153,7 +153,7 @@ namespace Microsoft.Tye.Hosting
}
var uri = new UriBuilder ( uris [ next ] . Uri )
{
Path = rule . PreservePath ? $"{context.Request.Path}{context.Request.RouteValues[" path "]} " : ( string ) context . Request . RouteValues [ "path" ] ? ? "/" ,
Path = rule . PreservePath ? $"{context.Request.Path}" : ( string ) context . Request . RouteValues [ "path" ] ? ? "/" ,
Query = context . Request . QueryString . Value
} ;
@ -697,6 +697,10 @@ services:
Assert . StartsWith ( "Hello from Application A" , await responseA . Content . ReadAsStringAsync ( ) ) ;
Assert . StartsWith ( "Hello from Application B" , await responseB . Content . ReadAsStringAsync ( ) ) ;
// checking preservePath behavior
var responsePreservePath = await client . GetAsync ( ingressUri + "/C/test" ) ;
Assert . Contains ( "Hit path /C/test" , await responsePreservePath . Content . ReadAsStringAsync ( ) ) ;
} ) ;
}
@ -145,6 +145,10 @@ spec:
serviceName : appb
servicePort : 80
path : /B(/|$)(.*)
- backend:
serviceName : appa
servicePort : 80
path : /()(C.*)
- host : a.example.com
http:
paths:
@ -151,6 +151,13 @@ spec:
number : 80
path : /B(/|$)(.*)
pathType : Prefix
- backend:
service:
name : appa
port:
number : 80
path : /()(C.*)
pathType : Prefix
- host : a.example.com
http:
paths:
@ -1,4 +1,4 @@
using System ;
using System ;
using System.IO ;
using System.Text.Json ;
using Microsoft.AspNetCore.Builder ;
@ -32,6 +32,12 @@ namespace ApplicationA
endpoints . MapGet ( "/" , async context = >
{
await context . Response . WriteAsync ( "Hello from Application A " + Environment . GetEnvironmentVariable ( "APP_INSTANCE" ) ? ? Environment . GetEnvironmentVariable ( "HOSTNAME" ) ) ;
await context . Response . WriteAsync ( context . Request . Path ) ;
} ) ;
endpoints . MapGet ( "/C/test" , async context = >
{
await context . Response . WriteAsync ( "Hit path /C/test" ) ;
} ) ;
// This method returns the body content and query string back to the caller, to test that the ingress passes those properly
@ -14,6 +14,9 @@ ingress:
service : appA
- path : /B
service : appB
- path : /C
service : appA
preservePath : true
- host : a.example.com
service : appA
- host : b.example.com