Why changing .htaccess file in Elastic Beanstalk tomcat environment is not reflected? - amazon-web-services

I have java 8 tomcat application deployed on Elastic Beanstalk on AWS. My initial design was that blog (WordPress) would be on same server as tomcat. But since this is Elastic Beanstalk, I moved by blog to a different EC2 (a different IP address). The blog works after I set up subdomain in Route53 as blog.syz.com. But I want to divert the traffic from xyz.com/blog to blog.xyz.com.
I am doing this by modifying .htaccess file.
I added a .htaccess file in the root of tomcat application and deployed to Elastic Beanstalk. But the redirect is not working.
To test, I tried changing the path of existing and do a redirect using .htaccess, but does not seem to take affect. Re started server but still not working.
What am I missing here?
Do I have to configure using .ebextension in Elastic Beanstalk?
Normally .htaccess in root folder should work.

Related

add godaddy domain to AWS Elastic Beanstalk site?

I have a working web app hosted on Elastic Beanstalk and have purchased a domain name on godaddy.
I've got it set up so when you visit the domain it takes you to the correct page but the URL changes to the ugly elastic beanstalk address.
At the moment when I visit the domain name URL, the URL changes to
uglyurl.5345435trgfdg.elasticbeanstalk.com/CORRECT/ROUTES
I want it like
mydomain.com/CORRECT/ROUTES
You need to configure whatever software you are running on Elastic Beanstalk (Apache or Nginx probably) to be aware of the domain name. The server software is simply redirecting all requests to the only domain it knows it is hosting.

301 redirect .ebextension example - AWS Elastic Beanstalk

Can anyone help me with a sample .ebextension file which adds a 301 redirect to IIS on a load balanced environment via Elastic Beanstalk?
I want to redirect a simple URL such as:
example.com/solutions/
to:
example.com/what-we-do/
We have an ebextension which tells IIS to serve over https, but nowhere can I find an example of someone trying to add a simple 301 redirect for one page to another page to IIS via Elastic Beanstalk.
(https redirect from AWS: https://github.com/awslabs/elastic-beanstalk-samples/blob/master/configuration-files/aws-provided/security-configuration/https-redirect/dotnet/https-redirect-load-balanced-dotnet.config for info)

.ebextensions conf file not getting detected

I am running a single instance machine behind a load balancer and I am able to setup the secure port domain to work for https://www.example.com.
I am trying to redirect both http://www.example.com to https://www.example.com
I am running Tomcat 8 on the instance behind the load balancer
I was toying around with AWS extensions to make the redirect work and I used the following links for my reference to create a .ebextensions directory.
Redirect Http Url to Https in Elastic beanstalk loadbalancer
I dont see the .ebextensions directory after deployment in the tomcat root folder
The content on elasticbeanstalk.conf doesnt include the rewrite rules and module reloads that I added to make the redirect work .It still seems to contain the default values the file had before deployment. Seems the .ebextensions didnt get executed at all
I have installed an AWS certificate manager on my load balancer.
I am able to manually access https://www.example.com
Cant figure out if I am missing something? Can someone in the community help me resolve the issues.

Why is AWS Route 53 Host Redirecting to Elastic Beanstalk Server?

Using Amazon's Guide, I created an Elastic Beanstalk application for a Wordpress/Woocommerce app. The EB domain contains a region, i.e., my-app.us-east-N.elasticbeanstalk.com. I followed the guide for using my own host (mysite.com), which I have set up on Route 53.
Whenever I hit mysite.com, I get a 301 redirect to my-app.us-east-N.elasticbeanstalk.com. I simply am using the A Alias record for mysite.com to point to that EB domain, exactly as in their guide. How do I stop it from redirecting? I dont want to use the EB domain, I want to use mysite.com to load the content coming from the EB domain. I havent yet found any AWS docs that explain this, the directions for doing what I want are incredibly simple (but dont seem to work).
There is nothing in default AWS Elastic Beanstalk setup that would cause such redirect. You should check if it is your app that is sending the redirect (especially since the Wordpress is known to force the redirect to its default/configured site URL).

How to link godaddy domain with application running on aws

I'm running into this problem trying to link my Godaddy domain with a AWS Elastic ip.I google it and got many documents on how to link a EC2 instance with a domain on Godaddy.I followed following steps :
1: I created a new Elastic ip, and mapped to my instance aws.
2: Edit godaddy A(Host) to point to this elastic ip.
But when i am pointing to my domain name i.e http://example.com it is showing my Jboss server console.I find and got that the war file name should be ROOT.war but i am running multiple application on same server so how can i point this domain to my specific application like "http://MyExample/index.jsp"
You can simply use any reverse proxy server like Nginx and create a configuration there to map the domain to the application running on the server.
Assuming your application is running on 127.0.0.1 at port 8081 on the server then nginx config would have something like
proxy_pass http://127.0.0.1:8081;
Use an application load balancer! Avoid NGINX for reverse proxying like a curse especially if you're going to down stream to an elastic load balancer that is fronting an elastic beanstalk.
Because you really should be removing your EC2 instance and running elastic beanstalks for your apps anyway :P