Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patches AWS Elastic Beanstalk's default nginx configuration to support websockets, for use with an Application Load Balancer.
container_commands:
enable_websockets:
command: |
sed -i '/\s*proxy_set_header\s*Connection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
@ronengreen

This comment has been minimized.

Show comment
Hide comment
@ronengreen

ronengreen Oct 31, 2016

hi , did not work for me , but - I use tomcat8 beanstalk instance ...
any suggestion ...?
error says that it did not find the config file .?

hi , did not work for me , but - I use tomcat8 beanstalk instance ...
any suggestion ...?
error says that it did not find the config file .?

@mbushman

This comment has been minimized.

Show comment
Hide comment
@mbushman

mbushman Jan 18, 2017

Did anyone get this script working for tomcat8 using the ALB?

Did anyone get this script working for tomcat8 using the ALB?

@alzap

This comment has been minimized.

Show comment
Hide comment
@alzap

alzap Jul 11, 2017

Yes, change your proxy server to nginx
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-platform.html#java-tomcat-platform-configfiles
I used the "Example .ebextensions/tomcat-settings.config"

option_settings:
  aws:elasticbeanstalk:container:tomcat:jvmoptions:
    Xms: 512m
    Xmx: 512m
    JVM Options: '-Xmn128m'
  aws:elasticbeanstalk:application:environment:
    API_ENDPOINT: mywebapi.zkpexsjtmd.us-west-2.elasticbeanstalk.com
  aws:elasticbeanstalk:environment:proxy:
    GzipCompression: 'true'
    ProxyServer: nginx
  aws:elasticbeanstalk:environment:proxy:staticfiles:
    /pub: public

alzap commented Jul 11, 2017

Yes, change your proxy server to nginx
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-platform.html#java-tomcat-platform-configfiles
I used the "Example .ebextensions/tomcat-settings.config"

option_settings:
  aws:elasticbeanstalk:container:tomcat:jvmoptions:
    Xms: 512m
    Xmx: 512m
    JVM Options: '-Xmn128m'
  aws:elasticbeanstalk:application:environment:
    API_ENDPOINT: mywebapi.zkpexsjtmd.us-west-2.elasticbeanstalk.com
  aws:elasticbeanstalk:environment:proxy:
    GzipCompression: 'true'
    ProxyServer: nginx
  aws:elasticbeanstalk:environment:proxy:staticfiles:
    /pub: public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment