问题
We have an Application Gateway operational with the following setup
Backend 1 : Server A, Server B
Backend 2 : Server C
Listener1 - site.com - Port 8888 HTTPS - Backend 1
Listener2 - site.com - Port 3000 HTTPS - Backend 2
Listener3 - site.com - Port 10001 HTTPS - Backend 1
This is routing correctly when site.com:port is specified however this isn't ideal for the end user to remember to include the port.
What we want to do is
sub.site.com to map to site.com:8888
sub2.site.com to map to site.com:3000
sub3.site.com to map to site.com:10001
OR
site.com/sub to map to site.com:8888
etc
This will allow the users to connect to the service via a friendly URL rather than the port number.
Would a path-based rule with the path as /sub and the HTTP setting as the custom port be sufficient?
Any advice greatly appreciated.
回答1:
You could do this via path-based routing rules or multi-site listener.
For the first scenario, you want sub.site.com to map to site.com:8888
. You could create a multi-site listener, then use frontend port 80 and hostname sub.site.com
in this multi-site listener. HTTP setting should specify the port 8888.
For the second, you want site.com/sub to map to site.com:8888
. You could add a path-based rule, set paths /sub/*
and backend pool1 and HTTP setting1 with port 8888. Also, the listener should have frontend port 80.
Make sure the listener is listening port 80 and HTTP setting has your custom port for your backend websites. If you will publish your website in the further, It's recommended to use multi-site websites. If you want to use this as a statusless request and hosting your websites, you could use path-based rules.
回答2:
It seems like you want to achieve end to end SSL with the above mentioned scenario.
Please follow the steps below:
- Create a Multi-site Listener with HTTPS endpoint with port 443 and upload a certificate and also give the Hostname. You will need to create 3 Listeners with on same port 443 and specify the hostnames.
- Create 3 HTTP settings and make sure you define the backend port respectively and choose HTTPS for end to end SSL. Basically, it means that your service in the backend still uses SSL, so upload .cer certificates on HTTP Settings.
- If you are grouping servers in a single backend pool, then the same service should be running on all the servers. In this case make sure both servers in backend pool run services on port 8888 and 10001.
- Create rules with corresponding Listener and HTTP settings and backend pool
Regards, Msrini
来源:https://stackoverflow.com/questions/54430959/application-gateway-routing-urls-to-custom-ports