-
Notifications
You must be signed in to change notification settings - Fork 86
Https request validation #123
Comments
What's wrong with |
Cool, nothing wrong with that validation, just I need to know where can I put the function and make it available for all controllers! |
@diemax if you are using |
Or just create an own controller plugin. There is no proper documentation, but you can add controller plugins to your configuration by using the
With that, you can execute If you dont want to have such overhead, you can just create a trait and use it in your controllers:
|
Thanks for the explanation! 😄 |
If you terminate HTTPS at your load balancer or gateway then requests come in to the web server with an http:// uri and the x-forwarded-proto header set to 'https'. In this case, zend frameworks getScheme functions all return 'http' when they should actually be returning 'https'. With the current behavior, if you terminate ssl at your LB or gateway, you can't use any of the zend uri functions to generate urls that show up in your response. For example, when a user hits a page that requires authentication in our app, they are redirected to the login page and a return url is passed to the login page. Users are being redirected from an https:// page to the https:// login correctly because that is hard-coded but the return URL is being set as http:// which is a security downgrade. This is due to $request->getUri() returning an http:// uri even if the x-forwarded-proto header is set. I'm having trouble figuring out the best place to resolve this. I feel like the cleanest way would be to create an HttpUri class in zend-http that extends the http class from zend-uri and overrides the getScheme function to respect the x-forwarded-proto header but that class has no knowledge of the request headers. |
This repository has been closed and moved to laminas/laminas-http; a new issue has been opened at laminas/laminas-http#6. |
Hi ZF team! Just a little thing:
How can I check if the
request
scheme ishttps
?Regardless the
getScheme()
method, does theRequest
class has a method for that?I can get the scheme:
So, where should I add this validation for make it available for all controllers?
Anyways, would be great add this method on the
Request
object.Thanks! great project 🥇
The text was updated successfully, but these errors were encountered: