Map real server folder to root

0

I am trying to have a LoadMaster sit in front of Blob Storage in Azure.  I have managed to get 90% of the way there through Modification Rules, but I need to strip the container name part of the path back out.  I can't see a way to modify the response such that the path is corrected.  Here are the rules I have set up for the request:

StorageHostName Replace Header   Host mydomain,com mydomain.blob.core.windows.net  
RootToIndex Modify URL     /^\/$/ /containername/index.html  
FixStoragePath Modify URL     /^\/([^/]+)$/ /containername/\0  

Can anyone help me figure this out?  Ultimately, I want the static content to be displayed as though it were set up as the root context of my domain, and then I will add routing to various services under a /api context.  I want to have a single VIP as the entry point to all of this, for fewer domain names and fewer certs.

Thanks.

2 comments

Avatar
0
Tony Vaughan

Morning Thiede,

I may need you to explain in more detail what you hope to match and replace,

but at a quick glance there seems to be a syntax error on this rule

/^\/([^/]+)$/
the formatting on the forum is a bit limited
if you take a look at https://regex101.com/ it should be clearer to read

the "/" in "[^/]" isn't being escaped
also if there is a start match "^" then there should be a end match "$" or a wildcard ".*"





 
Avatar
0
Brendon Thiede

Thank you very much for the reply.  The matching is not the issue, as it is appropriately matching the desired patterns.  I did change the pattern inside the character specification as you suggested and the result is the same.  I think the real issue is that my approach is either 1) completely wrong, or 2) not possible with LoadMaster.  I'll try my best to describe my desired outcome in terms of request/response

 

Root context gets a specific index.html file:

Request to https://mydomain.com/  responds with the content from https://mydomain.blob.core.windows.net/containername/index.html

 

A specific filename at the root context grabs a file by that name from blob storage:

Request to https://mydomain.com/something.js  responds with the content from https://mydomain.blob.core.windows.net/containername/something.js

 

API path is a routing to deployed services:

Request to https://mydomain.com/api/serviceone/  responds with the content from https://mydomain-serviceone.azurewebsites.net/containername/api/

 

(Optional) Any other path is sent to index.html for Angular to handle the route:

Request to https://mydomain.com/my/special/route  responds with the content from https://mydomain.blob.core.windows.net/containername/index.html but passes the route information from the URL as https://mydomain.blob.core.windows.net/containername/my/special/route