A good method to route individual customer URLs?

Hey there.

  • I've set up a backend for my application servers which are listening to IP:PORT/myapp
  • Now I want my customers to reach this backend via URL/customerid/myapp

I figured a good method to achieve this would be a PathPrefixStripRegex rule and strip the customerid. My app can now evaluate the request header X-Forwarded-Prefix and everything looks fine so far.

Is there an alternative/better solution to implement this?

Example:

[backends]
  [backends.myapp]
    [backends.myapp.servers]
	  [backends.myapp.servers.server0]
		url = "http://localhost:5000"
	  [backends.myapp.servers.server1]
		url = "http://localhost:5001"
	  [backends.myapp.servers.server2]
		url = "http://localhost:5002"
	  [backends.myapp.servers.server3]
		url = "http://localhost:5003"
		
[frontends]
  [frontends.customer]
    backend = "myapp"
    passHostHeader = true
    [frontends.customer.routes]
	  [frontends.customer.routes.route0]
	    rule = "Host:localhost"
      [frontends.customer.routes.route1]
	    rule = "PathPrefixStripRegex:/{customerid}/"