0

Trying redirect all http requests to HTTPS.

I have the redirect rules on my web.conf, but I get a too many redirect errors.

Found out I need to set up my Elasticbeanstalk to run a "container_command" to run a script. I got as far as this picture. enter image description here

Ran it in several yam structure checkers and they all pass it.

[2017-02-13T21:40:40.129Z] INFO  [1090]  : Loading manifest from bucket      'elasticbeanstalk-us-west-2-943111687699' using computed S3 key 'resources/environments/e-ecbvzu2fms/_runtime/versions/manifest_000000000000'.
[2017-02-13T21:40:40.273Z] INFO  [1090]  : Updated manifest cache: deployment ID 90 and serial 90.
[2017-02-13T21:40:40.273Z] DEBUG [1090]  : Loaded definition of Command CMD-AppDeploy.
[2017-02-13T21:40:40.274Z] INFO  [1090]  : Executing Application update
[2017-02-13T21:40:40.274Z] INFO  [1090]  : Executing command: CMD-AppDeploy...
[2017-02-13T21:40:40.274Z] INFO  [1090]  : Executing command CMD-AppDeploy activities...
[2017-02-13T21:40:40.274Z] DEBUG [1090]  : Setting environment variables..
[2017-02-13T21:40:40.274Z] INFO  [1090]  : Running AddonsBefore for command CMD-AppDeploy...
[2017-02-13T21:40:40.274Z] DEBUG [1090]  : Running stages of Command CMD-AppDeploy from stage 0 to stage 1...
[2017-02-13T21:40:40.274Z] INFO  [1090]  : Running stage 0 of command CMD-AppDeploy...
[2017-02-13T21:40:40.274Z] INFO  [1090]  : Running leader election...
[2017-02-13T21:40:40.522Z] INFO  [1090]  : Instance is Leader.
[2017-02-13T21:40:40.522Z] DEBUG [1090]  : Loaded 6 actions for stage 0.
[2017-02-13T21:40:40.522Z] INFO  [1090]  : Running 1 of 6 actions: InfraWriteConfig...
[2017-02-13T21:40:40.528Z] INFO  [1090]  : Running 2 of 6 actions: DownloadSourceBundle...
[2017-02-13T21:40:44.724Z] INFO  [1090]  : Running 3 of 6 actions: EbExtensionPreBuild...
[2017-02-13T21:40:45.102Z] INFO  [1090]  : Running 4 of 6 actions: AppDeployPreHook...
[2017-02-13T21:41:01.347Z] INFO  [1090]  : Running 5 of 6 actions: EbExtensionPostBuild...
[2017-02-13T21:41:02.390Z] INFO  [1090]  : Running 6 of 6 actions: InfraCleanEbextension...
[2017-02-13T21:41:02.392Z] INFO  [1090]  : Running stage 1 of command CMD-AppDeploy...
[2017-02-13T21:41:02.392Z] DEBUG [1090]  : Loaded 2 actions for stage 1.
[2017-02-13T21:41:02.392Z] INFO  [1090]  : Running 1 of 2 actions: AppDeployEnactHook...
[2017-02-13T21:41:21.024Z] INFO  [1090]  : Running 2 of 2 actions: AppDeployPostHook...
[2017-02-13T21:41:21.613Z] INFO  [1090]  : Running AddonsAfter for command CMD-AppDeploy...
[2017-02-13T21:41:22.088Z] INFO  [1090]  : Command CMD-AppDeploy succeeded!
  • 1
    Instead of trial/error, check the `/var/log/eb-commandprocessor.log` log to see why the command isn't working. Perhaps `asadmin` isn't in the path and you need to specify the full path to the command. – Mark B Feb 13 '17 at 19:55
  • I did, couldn't find a single mention of the function I created, or any errors or warnings at all. Do I need to enable anything so the beanstalk knows to look for the .config file there? From what I couldnt find online, people are using "asadmin" just like that – Marcel Caferati Feb 13 '17 at 20:02
  • 1
    And you are deploying a new version of your EB application with this updated file, correct? – Mark B Feb 13 '17 at 20:23
  • Yes, Everytime I upload I rebuild the entire application and deploy the war file again – Marcel Caferati Feb 13 '17 at 20:29
  • 1
    Try opening your WAR file to verify that the .exextensions directory is making it into the WAR file, and is in the root of the file, and not being excluded or ignored by your build tools. http://stackoverflow.com/questions/18423932/where-to-add-ebextensions-in-a-war – Mark B Feb 13 '17 at 20:34
  • Looks like that was one of the problems, but now I made sure the fail is there, on the WARs root, right next the web-inf folder, updated post with log – Marcel Caferati Feb 13 '17 at 22:02

1 Answers1

0

Wasn't able to run the command on EBS, solved my problem by adding a rule on UrlRewriteFilter.

Not the best way but works for now

<rule>
<condition type="header" operator="notequal" name="X-Forwarded-Proto">^HTTPS$</condition>
<condition name="host" operator="equal"test.com</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">https://www.test.com/$1</to>
</rule>
<rule>