1

We've got a Java server running on Tomcat8 on AWS ElasticBeanStalk. The project contains an AngularJS webapp as frontend. Our frontend webapp is accessible by www.domain.com/webappName. I put a .conf file in .ebextensions/httpd/conf.d in my root directory.

Here's the content of my conf.d (rule redirect to a new url with new version of frontend, in Angular7)

<VirtualHost *:80>
   LoadModule rewrite_module modules/mod_rewrite.so

   RewriteEngine on
   RewriteCond %{REQUEST_URI} ^/webappname/index\.html
   RewriteRule ^webappname/index\.html(.*)$ https://redirect-domain.com/$1 [R=301,L]

   <Proxy *>
     Require all granted
   </Proxy>

   ProxyPass / http://localhost:8080/ retry=0
   ProxyPassReverse / http://localhost:8080/
   ProxyPreserveHost on

   ErrorLog /var/log/httpd/elasticbeanstalk-error_log

</VirtualHost>

But rewriting not working. I tested my rule in localhost and on an online simulator and it was working fine. But when we deploying our War file on AWS ElasticBeanStalk, it's not working.

Do you know why ? It's look like the configuration file is bypassed. I tried with AllowOverride All but it doesnt work.

Our ElasticBeanStalk is running with Tomcat8, Java8 and Apache 3.3.2.

Persilos
  • 122
  • 1
  • 16
  • Have you checked these 2 links? https://stackoverflow.com/questions/24297375/how-to-get-elastic-beanstalk-nginx-backed-proxy-server-to-auto-redirect-from-htt and https://forums.aws.amazon.com/thread.jspa?messageID=794491 – qkhanhpro Feb 12 '20 at 02:54
  • The first one is regarding nginx when we use apache 3.2, for the second one we've already tried some solutions, without success. But thank, we will try to use nginx if we don't find solution with Apache. – Persilos Feb 12 '20 at 07:37
  • I mention the two because seems like many people run into same problem with rewriting URL which force them to use the "00_" file ... kind of like a hack that is prone to change from AWS time to time. Hope you resolve the issue soon – qkhanhpro Feb 12 '20 at 08:19

0 Answers0