I am using Amazon AWS EC2 to host my web application. My web application is hosted on 2 web servers and having Loadbalancer to manage traffic.
I am using CodeIgniter framework.
My problem is when I try to login to my application, Loadbalancer is routing my request to wrong server and even with correct Login Password I am not able to Login to my application and due to this my session is not started.
Thank you in advance:)
You should be enabling the sticky session feature.
If you are using AWS ELB (Classic Load Balancer), then check out how to configure sticky sessions.
Related
So, I'm working on a hackathon project right now, and for the demo, I've spun up a NodeJS Express server on an EC2 via Elastic Beanstalk. When testing the server's API with our front-end locally, it worked perfectly fine.
Now we've deployed our front-end to AWS Amplify, setup a domain name in Route53, and hooked everything up. When we go to the domain, our front-end looks great, but when we try using the functionality that would connect to our server's API, we get a net::ERR_SSL_PROTOCOL_ERROR.
Doing some research, it looks like(?) that we have to setup a certificate on the Classic Load Balancer that's in front of the EC2. So I requested a certificate, and created a listener on the Load Balancer as follows:
Load Balancer Protocol
Load Balancer Port
Instance Protocol
Instance Port
HTTPS
443
HTTPS
3000
But now I realize that if setup this way, I still have no idea how to point the React Frontend's API calls to the Load Balancer instead of the EC2, or whether the listener is setup correctly. Would anyone have an idea of what steps we should take here?
For the details of the app, the backend is a pretty straightforward Express App with CORS enabled, and the frontend is a fairly standard React project, nothing special about either of them.
Instance Protocol should be HTTP. So your setup uses HTTPS only between client and CLB:
Client--- (HTTPS) ---> CLB --- (HTTP) ---> EC2
Also for properly setup HTTPS, you need to use your own domain. You can't use default domain provided by EB for your application.
I have created a react app that connects to a Springboot API on an Elastic Beanstalk.
I'm successfully connecting to my Beanstalk API from my local machine, but my React app (deployed with Amplify) receives a ERR_CONNECTION_REFUSED.
What could be the reason?
The Url I'm using to connect from the React app is: http://ec2-18-133-11-111.eu-central-1.compute.amazonaws.com (I modified the ip for privacy reasons)
EDIT For some reason, The api call is being redirected to https. I think this is the reason. How do I prevent this?
Here is how the sg inbound is configured:
What else do I need to do?
I am trying to setup Authentication for some certain routes using AWS internet-facing Application load balancer.
I've done all the steps from the official AWS documentation, and also using this one:
https://www.thorntech.com/2018/09/user-authentication-alb-cognito/
I was testing via load balancer's DNS name, and it redirects me properly to the login form of Cognito, but after I am logged in it redirects to the load balancer, and it gives 500 Internal Server Error. URL is like so https://xxxxx.eu-west-1.elb.amazonaws.com/oauth2/idpresponse?code=.......
Do you know, which can be the causes of it, and what should I configure else to make it working?
openid is allowed
To answer my own question - the problem is with the security groups.
You have to have a security group with the open port 443 on your load balancer!
We have a back-end website deployed on AWS. I deploy a front-end website in local tomcat and send a request to back-end website in order to get some object data with homemade soap api. Dose it work?
Yes , literally you are trying to access a remote api from local environment. After the deployment in AWS do make sure the security groups allows the protocol and port number, to be communicated from remotely.
By default there ports are not allowed.
Looks like you are trying to connect to a SOAP Webservice hosted in AWS. There is no reason it shouldn't be working, Only thing is you have to properly configure your AWS security groups attached to your backend server, to allow connections from your frontend website. Use front-end server port as the source ip in your security group. You might also have to allow outgoing connections from the network where your frontend server is hosted if it is protected by a firewall.
I have a web app on AWS using CloudFront, an Elastic Load Balancer, and an EC2 host.
I am attempting to place 'Basic Access Authentication' on it to give it simple password protection.
Do any of these AWS services provide this?
I notice that S3 has documentation on requiring the http authentication header, but I don't notice such documentation for the CloudFront, ELB, or EC2 services my app uses.
How can I setup Basic Access Authentication for my app?
It's fairly simple.
Just set up HTTP authentication on your webserver level.
You can follow this if You're using Nginx: https://www.digitalocean.com/community/tutorials/how-to-set-up-basic-http-authentication-with-nginx-on-ubuntu-14-04
And for Apache: https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04
Let me know if this helps.