-
-
Notifications
You must be signed in to change notification settings - Fork 230
Added ROUTE::OPTIONAL_SECURED #1196
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
Conversation
This option for route allows to access route via both HTTP&HTTPS without redirection. Href URLs will be generated in currently used protocol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong coding style, should be in upper case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...FALSE should be in uppercase for clarification
|
👍 for the idea, 👎 for the implementation. I currently do the following in my routes factory to achieve this behavior: if ($request->isSecured()) {
Route::$defaultFlags |= Route::SECURED;
} |
|
I think this implementation is worse, it has unwanted behavior - it will set to every route this property. In my implementation you can select which routes have this property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPTIONALLY_SECURED is gramatically right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will commit grammatical fix later
|
I like the idea too. I'm using it often in private applications. @Majkl578 solution is often used as: $optionallySecured = $request->isSecured() ? Route::SECURED : 0;
new Route(..., ..., Route::FLAG | $optionallySecured); |
You can't generalize it like this. It may or may not be an intended behavior. Since I make apps using Facebook, it's intended. Otherwise I use more-or-less what @milo mentioned: new Route(..., ..., Route::$defaultFlags | $optionallySecured); |
It may be inteded behavior (depends on project), but as default I would like to keep existing state.
Solution of @milo is fine, but I think is less userfriendly for beginners (why to explain bit OR to beginner during routing). |
…ed to Bridges (BC break!)
added Nette\Bridges
…gIterator (BC break!)
991ba1a to
e23de7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not save the state here, it's not neccessary and makes it harder to test router.
|
@vjirovsky great idea 👍 |
|
I use same code as @Majkl578 if ($request->isSecured()) {
Route::$defaultFlags |= Route::SECURED;
} |
|
This issue is mostly problematic because developers realize it quite late - after deploying application into a production. Till then, they expect routing will work as same as it ignores domain names. The route doesn't force any protocol, so this behavior should be the default one. |
|
@hrach I force it at Nginx mainly. |
|
@f3l1x please follow the text, so do I, so does everyone. |
👍 Can anyone think of some negative impact? Current default behavior (correct me please if I'm wrong) is to accept (match) both HTTP and HTTPS requests but generate always HTTP unless SECURED flag is set. Behavior matrix to summarize
|
|
I'm not sure whether running both HTTP & HTTPS is still an issue nowadays... |
|
Idea: What about not to update Route, but: It will warn people that there is something to configure. |
|
IMHO default behavior can be changed to copy protocol when route mask doesn't contain domain or when generated domain is the same as current domain (+subdomain). |
Can this be done in Nette 2.4? |
…rotocol (BC break) [Closes nette/nette#1196][Closes nette/routing#14]
…rotocol (BC break) [Closes nette/nette#1196][Closes nette/routing#14]
…rotocol (BC break) [Closes nette/nette#1196][Closes #14]
…rotocol (BC break) [Closes nette/nette#1196][Closes #14]
…rotocol (BC break) [Closes nette/nette#1196][Closes #14]
…rotocol (BC break) [Closes nette/nette#1196][Closes #14]
This option for route allows to access route via both HTTP&HTTPS without
redirection.
Href URLs will be generated in currently used protocol.