Wildcard Subdomain In SpringBoot For my Mac

1 answer

I am creating a web application in which there will be multiple subdomain. Each client will be having its own subdomain. Each subdomain will have individual database. For example I am having a client abc, then it will have subdomain as abc.mydomain.com and its database name will be abc.

Now this application is created in spring boot. Here I want to configure wildcard subdomain. So how can I configure it in spring boot. For this, I had tried few solution.

I had changed my /etc/hosts and added an domain name entry in it as below www.mydomain.com

But now I want subdomain in this. How can I do it.

I had seen somewhere that I need to configure server.xml of tomcat. In server.xml I had added below line.

<Host name="www.mydomain.com"  appBase="webapps" unpackWARs="true" autoDeploy="true">     <Alias>*.mydomain.com</Alias> </Host> 

Can you please help me with this. Also let me know incase you need more details in this.

All answers to this question, which has the identifier 61214265

The best answer:

After been working for multiple days I came to a solution for this question. As I was working for wildcard subdomain in localhost. Thus for this I need to use an external software called dnsmasq, I had executed following commands to install dnsmasq in my laptop.

brew install dnsmasq

After installing dnsmasq in my laptop I need to to configure it. For this I have to update the dnsmasq. For my case it is located at


In this file I have to add few lines to configure wildcard subdomain. Lines are as below.

# Route all *.mydomain.com addresses to localhost address=/mydomain.com/ # Don't read /etc/resolv.conf or any other configuration files. no-resolv # Never forward plain names (without a dot or domain part) domain-needed # Never forward addresses in the non-routed address spaces. bogus-priv 

Next I need to restart my dnsmasq service. Command for it is as below.

sudo brew services start dnsmasq

Finally you need to create a file mydomain.com at /etc/resolver (Create folder resolver if not exists). Add below line in mydomain.com file.


This is the complete configuration for setting up swildcard subdomain in your mac os.

For reference you can follow this link

Last questions

how do i remove the switch on my home screen?
how to edit the JS date and time to update atuomatically?
How to utilize data stored in a multidimensional array
Powermockito not mocking URL constructor in URI.toURL() method
Android Bluetooth LE Scanner only scans when phone's Location is turned on in some devices
docker wordpress container can't connect to mysql container
How can I declare a number in java that is more than 64-bits? [duplicate]
Optaplanner solutionClass entityCollectionProperty should never return null error when simple JSON object passed to controller
Anylogic, get the time a pedestrain is in a queue
How do I fix this syntax issue with my .flex file?
Optimizing query in PHP
How to find the highest number of a column and print two columns of that row in R?
Ideas on “Error: Type com.google.firebase.iid.zzav is referenced as an interface from com.google.firebase.messaging.zzd”?
JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()
PHP total order
Laravel booking system design
neural net - undefined column selected
How to indicate y axis does not start from 0 in ggplot?
Fragments in backStack
Spinner how to change the data