Closed coryasilva closed 8 years ago
Looks pretty good, the only change I think would make sense is to move the value of Access-Control-Max-Age
to the config. Seems a bit of a "magic number" to just include it directly on the template. Also would make it for easier customization.
Yeah I was thinking about moving all of the header values to the settings but was trying not to pollute the settings and/or overwhelm the users. Then again if you are tracking bugs you are probably a developer or IT guy...
What do you think all settings or just add maxAge
I had the same thought (re: too many settings).
But there is a trick that can allow conciseness and also extensibility.
The getSetting()
method takes a second argument for a default value, so that if the requested setting is not found on the Config file, it returns that value.
That way you can do something like:
var cors.allowCredentials = service.getConfig().getSetting("cors.allowCredentials", false);
without having to necessarily add more stuff to the config. The only important bit would be to add some documentation somewhere indicating the additional/optional config settings that can be used to configure CORS. I think just a brief comment on the listener cfm indicating the names of the used settings should be enough.
Okay that makes sense; I think my last commit should do it.
Merged to the 1.8 branch. Will be merged into master shortly.
Awesome. Thanks.
@oarevalo This is working in our simple production environment and everything works. Though, please review the code as I am a coldfusion noob.
This is in response to pull request #128, but with proper branching