RajaseharR
RajaseharR

Reputation: 31

Is there any possibility to have two BaseURL WebHostUrl in ServiceStack?

We are running AppService in cloud. The WebHostUrl url is stored in web.config file and assigned the url in application start event as like below.

SetConfig(new HostConfig { 
    WebHostUrl = baseUrl,
);

We have requirement to configure two baseurl in servicestack. That means, the appservice can be accessed either of two url.

https://example1.com/appservice

or

https://example2.com/appservice.

Please suggest how to achieve this.

Upvotes: 3

Views: 119

Answers (1)

mythz
mythz

Reputation: 143319

If you don't specify the BaseUrl ServiceStack automatically uses the URL for the incoming Request.

Basically you don't want to define these URLs in ServiceStack, the 2 virtual hosts should be handled by an external reverse proxy like nginx. The nginx/rsync deployment docs shows an example for how to configure a virtual host to use an Nginx reverse proxy. You'd just need to create 2 virtual hosts for each domain you want to support.

Upvotes: 2

Related Questions