How to include request header into pathPrefixRewrite of urlMap?
I am building a hosting service with many FQDNs.
Cloud Stoage has HTML files in each FQDN folders like below:
- BUCKET
- example1.com/
- index.html
- page2.html
- example2.com/
- index.html
- page2.html
- ...
When Browser requests https://example1.com/index.html,
Load Balancer should transfer request to backend bucket with path "/example1.com/index.html".
And YAML should be below.
defaultService: ...
hostRules:
- hosts:
- example1.com
pathMatcher: index
pathMatchers:
- name: index
defaultService: ...
pathRules:
- paths:
- paths:
- /*
routeAction:
urlRewrite:
pathPrefixRewrite: /example1.com/
service: ...
But If the Load Balaner receives requests of many hosts.
I want to write YAML like below similar to nginx variable, let me know the actual syntax to handle many hosts.
defaultService: ...
hostRules:
- hosts:
- '*'
pathMatcher: index
pathMatchers:
- name: index
defaultService: ...
pathRules:
- paths:
- paths:
- /*
routeAction:
urlRewrite:
pathPrefixRewrite: /$host/
service: ...
Thanks,