-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
feat() add host matching support to controllers #2980
Conversation
Pull Request Test Coverage Report for Build 3336
💛 - Coveralls |
a58e32c
to
eb255e9
Compare
eb255e9
to
5be9119
Compare
5be9119
to
75a4383
Compare
75a4383
to
d6bd3f1
Compare
Thanks for your contribution! I'll review it shortly. |
}); | ||
} | ||
|
||
private applyHostFilter(host, handler) { | ||
if (!host) { | ||
return (req, res, next) => { |
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.
Can't we just return handler
here? (without setting the hosts
property on req
)
Would you like to create a PR to the docs with this feature? :) |
@kamilmysliwiec, the docs are done via the docs.nestjs.com repo, right? I'll open a PR today. |
PR for documentation update: nestjs/docs.nestjs.com#737 |
Thank you! This will be published as 6.12.0 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently the request hostname is not taken into consideration when dispatching routes.
Issue Number: #2521
What is the new behavior?
host
@Controller
setting that changes controller to only route if the request host matches.host
value may capture parameters, e.g.:tenant.example.com
@HostParam
parameter decorator that returns captured host parameter, e.g.@HostParam('tenant') tenant: string
{ host: ":tenant.example.com" }
filter will return a500
response with anHTTP Adapter does not support filtering on { host: ":tenant.example.com" }
message.Does this PR introduce a breaking change?
Other information