Fixed #15374: load TrustProxies middleware in Kernel.php #15379
Merged
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.
Description
Loads the (already implemented) TrustProxies middleware.
Fixes a whole sleuth of issues pertaining to reverse proxies. People complaining about it have been pointed towards correctly configuring their trusted proxies; however it turns out even if they did, Snipe-IT failed to load the middleware responsible for taking them into account.
No additional dependencies required.
Before:
After:
Fixes #15374
Might also fix (non-exhaustive list):
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Relevant details: run the
snipe/snipe-it
Docker image on a machine, exposing port 80 of the container as port 8080 of the host (127.0.0.1 only if you prefer). Slap a reverse proxy in front of it. Make sure you set all the relevant headers for proxy stuff. If you're using nginx; that would be:On the Snipe-IT config side, make sure you set
APP_URL
to whatever you'd use to reach your reverse proxy. And setAPP_TRUSTED_PROXIES=172.17.0.1
. This is the IP address of the docker host from the perspective of the docker container, on linux. On other platforms, set it to whatever is appropriate. If you're not sure,0.0.0.0/0
or*
should probably work, but I haven't tested it because I do not use such platforms.Open the correct app url that connects you to the reverse proxy (that proxies your request to the snipe-it container). See a big red error, because snipe-it thinks its hostname is
localhost:8080
even though you told it to expect something else.Apply the patch, change nothing else. Live in a sea of blissful green checkmarks.
Test Configuration:
snipe/snipe-it
snipe/snipe-it
Checklist: