Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an override flag to change behaviour when Jets is behind an ELB running Jets Server #584

Merged
merged 4 commits into from
Sep 1, 2021

Conversation

TeddiO
Copy link
Contributor

@TeddiO TeddiO commented Aug 27, 2021

  • This is a πŸ™‹β€β™‚οΈ feature or enhancement.
  • This is a 🧐 documentation change.
  • I've added tests (if it's a bug, feature or enhancement)
  • I've adjusted the documentation (if it's a feature or enhancement)
  • The test suite passes (run bundle exec rspec to verify this)

Summary

This PR adds an override flag (JETS_SERVER_ELB_OVERRIDE) so if jets server is being fed traffic through an ELB, we get the same behaviour as if we were hitting it locally or through another load balancer.

Context

As part of some internal work going on where I work, there's been a need to create a stronger feedback loop with a copy of various services, including one that uses Jets. These services can be fed through an ELB (typically an ALB) and will generally work as they would as if in a production environment however, Jets appears to diverge in its behaviour if we're behind an ELB -

https://github.com/boltops-tools/jets/blob/1ccd80b49d22bfdd53fa22f998b6faae37d8fe33/lib/jets/controller/middleware/local.rb#L71-L74

Returning false here resolves the issue and gets our intended behaviour. Unfortunately, I don't have enough context as to why this is being done and I don't want to risk potentially breaking anyone that might be using behaviour around this so I've added it in as a flag instead.

I'm not a Ruby developer by trade so please feel free to give pointers if there's a better way!

How to Test

Set up Jets to work behind an ELB and running in jets server. Without JETS_SERVER_ELB_OVERRIDE you'll get a 500 error (as well as a stack trace if you're running in a debug mode). JETS_SERVER_ELB_OVERRIDE being set to any value (recommendation 1) will override this logic and have it functioning as intended.

Version Changes

A patch bump (e.g. 3.0.14) is recommended for a bump in version.

@tongueroo tongueroo merged commit c47d2cf into rubyonjets:master Sep 1, 2021
tongueroo added a commit that referenced this pull request Sep 1, 2021
@tongueroo tongueroo mentioned this pull request Sep 1, 2021
@tongueroo
Copy link
Collaborator

Made some slight adjustments in #586. The flag is called JETS_ELB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants