-
Notifications
You must be signed in to change notification settings - Fork 222
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
Pass r *http.Request
to AllowOriginFunc
#59
Comments
aeneasr
pushed a commit
to aeneasr/cors
that referenced
this issue
Aug 26, 2018
This patch introduces cors.Config.AllowOriginRequestFunc ( `func (r *http.Request origin string) bool`) which is a custom function to validate the origin. It takes the HTTP Request object and the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` and `AllowOriginFunc` is ignored Closes rs#59 Signed-off-by: arekkas <[email protected]>
aeneasr
pushed a commit
to aeneasr/cors
that referenced
this issue
Aug 26, 2018
This patch introduces cors.Config.AllowOriginRequestFunc ( `func (r *http.Request origin string) bool`) which is a custom function to validate the origin. It takes the HTTP Request object and the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` and `AllowOriginFunc` is ignored Closes rs#59 Signed-off-by: arekkas <[email protected]>
This was referenced Aug 26, 2018
aeneasr
added a commit
to aeneasr/cors
that referenced
this issue
Aug 26, 2018
This patch introduces cors.Config.AllowOriginRequestFunc ( `func (r *http.Request origin string) bool`) which is a custom function to validate the origin. It takes the HTTP Request object and the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` and `AllowOriginFunc` is ignored Closes rs#59 Signed-off-by: arekkas <[email protected]>
2 tasks
rs
pushed a commit
that referenced
this issue
Aug 26, 2018
This patch introduces cors.Config.AllowOriginRequestFunc ( `func (r *http.Request origin string) bool`) which is a custom function to validate the origin. It takes the HTTP Request object and the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` and `AllowOriginFunc` is ignored Closes #59 Signed-off-by: arekkas <[email protected]>
Note to readers of this issue: because |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's currently not possible to set CORS based on e.g. HTTP Authorization. This is because signature
AllowOriginFunc func(origin string) bool
does no haver *http.Request
. This makes advanced use cases impossible and the function for anything else than maybe wildcard-based subdomain matching. There's actually a fork that does that (https://github.com/go-chi/cors) but this should really be added here.The text was updated successfully, but these errors were encountered: