1

I would like to change the SpringBoot Application URL.

As my current application.properties file looks like this :

spring.application.name=MyApplication

server.port=9090

and the directory structure is

src/main/resources/static/ui/index.html

src/main/resources/application.properties

So , while running the application, I need to do

http://localhost:8080/ui/index.html

as static directory is directly map to public directory.

But the issue is , I don't want see this : I would like to access the application as :

http://myurl.com and it should be map to above url i.e. http://localhost:8080/ui/index.html

How can I achieve this, As Spring boot contains embedded tomcat container.

If I can't achieve this, suppose I buy I domain name, then how to map domain name with this url.

I tried with dummy domain name mapping, it maps successfully but when it resolves the actual url is displayed in the browser. It show entire url i.e http://192.168.1.102:8080/ui/index.html whereas I need http://myurl.com/index.html.

I have look around https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html for spring boot application properties fields but didn't find any solution. as server.display-name also didn't worked for me.

If I buyied myurl.com how to map it with Spring boot application if my application is running on cloud.

Thank you in Advance. Examples are appreciated. :)

Gergely Bacso
  • 14,243
  • 2
  • 44
  • 64
virsha
  • 1,140
  • 4
  • 19
  • 40
  • You need to register your ip with DNS with name as myurl.com – SMA Jan 08 '16 at 11:06
  • yeah, say I have register then do we need to change any settings in our application . Because I tried with some dummy domain name , it successfully navigates to my application. But still it shows complete url i.e. 192.168.1.102:8080/ui/index.html – virsha Jan 08 '16 at 11:09
  • This has nothing to do with Spring. You have a webapplication that communicates via HTTP. From that on, what you need is figuring out how to route the traffic via specific URLs. – Gergely Bacso Jan 08 '16 at 11:12
  • 1
    I have seen an example where they can configure their local domain name https://github.com/tobiasflohre/movie-database , so I am confused , how they do in Spring project – virsha Jan 08 '16 at 11:13
  • I am also facing the same issue, if possible please help me too, to resolve this issue. – Dev Sabby Sep 15 '17 at 11:41

0 Answers0