Adds an override flag to change behaviour when Jets is behind an ELB running Jets Server #584
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bundle exec rspec
to verify this)Summary
This PR adds an override flag (
JETS_SERVER_ELB_OVERRIDE
) so ifjets 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
. WithoutJETS_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 (recommendation1
) 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.