You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flagging this as somewhere between issue discussion and possible / proposed fix — I noticed in my project that, when requesting a particular URL with a trailing slash, event['requestContext']['http']['path'] coming from AWS will omit the trailing slash. I lost a couple hours digging into redirect loop ( in Django, repeatedly trying to redirect to the admin login screen with its trailing slash in the URL, but never getting there because AWS's event doesn't pass that final slash along ) before finally discovering the issue.
Interestingly, another event property, event['rawPath'] will correctly pass along that trailing slash. Don't know if it is documented anywhere in AWS world why one ( the "raw" path ) would include it, and the other would omit it, but after confirming this discrepancy side by side, I switched to another library which I found does use rawPath and it worked without issue. 💁🏻♂️
This feels like AWS's bug to fix ultimately ( either in code for consistency's sake, or at least documentation; ideally both ), and no interest or need in pitting two open source projects against eachother, but using rawPath or some derivative could be a solution here.
Worth noting for my particular instance, Django has a whole APPEND_SLASH setting and middleware to handle this, but the admin redirect logic I mentioned kicks in before this fallback does. Maybe my scenario is too narrow / niche to warrant a code change 💁🏻♂️ but the admin's a pretty prominent cornerstone of using Django to begin with, and, anyway anyway ... mostly wanted to get this issue out of just my own brain, and hope this might help save someone a couple hours in the future. 👋🏻
The text was updated successfully, but these errors were encountered:
Python Version
3.9
Package Version
Latest
Description
Flagging this as somewhere between issue discussion and possible / proposed fix — I noticed in my project that, when requesting a particular URL with a trailing slash,
event['requestContext']['http']['path']
coming from AWS will omit the trailing slash. I lost a couple hours digging into redirect loop ( in Django, repeatedly trying to redirect to the admin login screen with its trailing slash in the URL, but never getting there because AWS's event doesn't pass that final slash along ) before finally discovering the issue.Interestingly, another event property,
event['rawPath']
will correctly pass along that trailing slash. Don't know if it is documented anywhere in AWS world why one ( the "raw" path ) would include it, and the other would omit it, but after confirming this discrepancy side by side, I switched to another library which I found does userawPath
and it worked without issue. 💁🏻♂️This feels like AWS's bug to fix ultimately ( either in code for consistency's sake, or at least documentation; ideally both ), and no interest or need in pitting two open source projects against eachother, but using
rawPath
or some derivative could be a solution here.Worth noting for my particular instance, Django has a whole
APPEND_SLASH
setting and middleware to handle this, but the admin redirect logic I mentioned kicks in before this fallback does. Maybe my scenario is too narrow / niche to warrant a code change 💁🏻♂️ but the admin's a pretty prominent cornerstone of using Django to begin with, and, anyway anyway ... mostly wanted to get this issue out of just my own brain, and hope this might help save someone a couple hours in the future. 👋🏻The text was updated successfully, but these errors were encountered: