How to point spring boot java app to subdomain? - spring-boot

i'm very new to AWS and currently having issues with domain and subdomain for my app.
I'm trying to host my Java Spring Boot web application as REST API and Angular app as front end on AWS EC2 instance. I want my Angular to run on port and be accessible via example.com and my java app to be accessible via api.example.com.
I've connected domain from godaddy to my Elastic IP already, and created Hosted zone in Route 53 for subdomain and added nameservers to domain on godaddy. Currently i'm waiting for propagation, and I assume that once I run angular on port :80, it will be accessible via example.com.
But how to point java app to api.example.com ?
As spring boot is using embedded tomcat, where should I set up a link between port and subdomain?
Thank you for your help.

Related

ELB not able expose 2 services

I have one spring-boot and one react app deployed on 1 ec2 instance.
I am trying to expose both to public internet via and ELB.
Spring-boot runs on 8080 port. eg localhost:8080/v1/api**
react app runs of 3000 port. eg. localhost:3000
I would like to expose them both using Elastic Load balancer on aws.
I have 2 target group created.
one maps / --> this is mapped to the springboot app.
another one maps to /index.html
But it not able to resolve.

How can I deploy a Spring Boot REST API to BanaHost cPanel?

I created a full stack application (Angular front end, java spring boot back end, mysql database), and I was able to upload successfully both the angular files and mysql into BanaHost cPanel, however I have not found useful information on how to upload spring boot REST API, as a consequence only the front end is working. How can I deploy this REST API on cpanel?
Spring Boot Applications can't just upload and deploy if you're utilizing a cPanel Web hosting (shared) plan, like you deployed the Angular Application by uploading.
For spring boot you must do it yourself, a Virtual Private Server or Dedicated Server will unlock the site hosting restriction. If you are not much familiar with the Linux command line, you can use a Window VPS instead. Providers like, Digital Ocean, Linode, and Oracle Cloud all provide free trials.
And also, there are platforms, such as Heroku (Platform as a Service(PaSS)), where you can deploy your app without the need for a VPS. You can refer their documentation regarding this:
https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku

Spring boot API endpoint does not work after setting the DNS record

I have a spring boot web service running on localhost:8000 with an embedded Apache Tomcat.
Frontend is developed using Angular and is running on nginx and port 80. Connection between front- and back-end is established with a REST API endpoint, i.e. /v1/getdata/...
We have a static IP and outside access is OK with this configuration. But after setting a DNS record, i.e. https://x.y.com for the static IP, the spring web server does not return data and ERR_TUNNEL_CONNECTION_FAILED error is occurred in Angular, although the front-end is loaded successfully on port 80.
The only server-side configurations in Spring app is server.port=8000 and CORS configs.
I have set [STATIC-IP]:8000 and https://x.y.com:8000 for the api address in Angular but neither worked. However accessing with static IP is still working.
I think there is a problem with SSL configuration.
Any Ideas?

Deploy SpringBoot Api into IIS Web Server

I created spring boot api with gradle build. everything working fine in my local.
I deployed angular app in Sites/DefaultsTest in IIS web server. it run in https://example.app.com/app
SpringBoot API base path is '/api'
I want to deploy spring boot api in same windows server machine and should able to access through Angular App globally.
please guide me.
IIS WebServer Dashboard
As far as I know, the spring boot API is a java web application, we don't suggest you directly hosted the java web application in the IIS.
I suggest you could try to install a docker or using tomcat to host the application, then you could use IIS reverse proxy to redirect the request to that API to get the result.
More details about how host the spring boot application on the docker, you could refer to below article.
https://blog.codecentric.de/en/2017/04/ansible-docker-windows-containers-spring-boot/
More details about how to use IIS reverse proxy, you could refer to below article.
https://blogs.msdn.microsoft.com/friis/2016/08/25/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world-apps/

Run spring boot website without adding HTTP or HTTPS

I am working with spring boot microservice application and gateway generated using jhipster. I have hosted my site on AWS EC2 instance.
Site Url: http://192.167.1.17:8082
I have redirected the port to 443 to run on https.
Let's say my site is :
http://192.167.1.17 OR http://mytestsite.com
Now the requirement is that if I type in the browser - 192.167.1.17 OR mytestsite.com
It should automatically redirect to :
http://192.167.1.17 OR http://mytestsite.com
Spring boot application has embedded tomcat. How can I do this HTTP or HTTPS redirect automatically with the hosted site on AWS EC2 instance?

Resources