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)
Related
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.
I'm using Amazon Web Services, and have a windows server running IIS.
Within IIS I have the default website, and another website:
I have an Elastic Load Balancer setup in Route 53 my DNS records point to the load balancer:
If I browse to http://mydomain.co.uk - it goes to the correct website in IIS.
If I browse to http://www.mydomain.co.uk - it goes to the Default website in IIS.
Is there any way I can point both www and non-www to the same website in IIS? Are my DNS records setup incorrectly?
Thanks for any help,
Mark
If both DNS records are resolving to the correct ip address of your server, then all you should need to do is setup multiple bindings on the correct website - one for www and one for the naked domain.
MY guess is that there is no IIS binding for the www, so it is resolving to the 'Default' site instead - you fix this in IIS console, not AWS console.
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.
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).
I've been struggling and googling this issue for a while and although it seems to
me like a pretty standard requirement I couldn't find a working solution anywhere.
I don't want to disable HTTP, only redirect it to HTTPS.
Not between the load balancer and the EC2 instances, but between the browser and the load balancer.
I have created an Elastic Beanstalk environment (Linux) for my Spring Boot app,
configured the load balancer for HTTP + HTTPS using the management console and
configured environment variables and IP tables using .config files in an .ebextensions
folder zipped with the app's JAR file.
Then I tried adding an NGINX configuration for a permanent HTTP to HTTPS
redirect using a config file with a "files" key, but it doesn't seem to have any effect.
Thanks
This is my NGINX configuration to redirect to https:
# HTTP - redirect all requests to HTTPS
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
}
Give it a try if not please paste your NGINX configuration file