Skip to content
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

Problem with external properties in production mode #31

Open
JcrGit opened this issue Nov 27, 2014 · 6 comments
Open

Problem with external properties in production mode #31

JcrGit opened this issue Nov 27, 2014 · 6 comments

Comments

@JcrGit
Copy link

JcrGit commented Nov 27, 2014

Hi,

We use grails cors plugin in our project and we have seen a strange issue :

When I wrote in config.groovy :
cors.url.pattern = '/beer/_'
cors.allow.origin.regex='._mon.domaine.autorise([/].*)?

And started application (in dev mode and prod mode), I have tested theses cases :

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/" --verbose http://sf713606.societe.mma.fr:8084/applicationBlanche/immortalCats
=> No headers in response

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/" --verbose http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> headers in response :
Access-Control-Allow-Origin: http://mon.domaine.autorise/authenticationFom/
Access-Control-Allow-Origin: true

curl -H "Origin: http://mon.domaine.non.autorise/authenticationFom/" --verbose http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> No headers in response

==> All is good.

But we need to externalise params in config.properties; we wrote this in config.properties and suppressed it from config.groovy :
cors.url.pattern = '/beer/_'
cors.allow.origin.regex='._mon.domaine.autorise([/].*)?

When the application starts in prod mode we have these results :

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/" --verbose http://sf713606.societe.mma.fr:8084/applicationBlanche/immortalCats
=> headers in response :
Access-Control-Allow-Origin: http://mon.domaine.autorise/authenticationFom/
Access-Control-Allow-Origin: true

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/" --verbose http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> headers in response :
Access-Control-Allow-Origin: http://mon.domaine.autorise/authenticationFom/
Access-Control-Allow-Origin: true

curl -H "Origin: http://mon.domaine.non.autorise/authenticationFom/" --verbose http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> headers in response :
Access-Control-Allow-Origin: http://mon.domaine.non.autorise/authenticationFom/
Access-Control-Allow-Origin: true

==> It's like the plugin don't see the params and make a default comportment. Could you test it ?

PS : We use grails 2.2 and grails cors plugin 1.1.6 and standards grails mechanincs for properties.

@davidtinker
Copy link
Owner

Hmm. I will have a look. I haven't ever used an external properties file
for a Grails app, only external .groovy files.

On Thu, Nov 27, 2014 at 12:43 PM, JcrGit [email protected] wrote:

Hi,

We use grails cors plugin in our project and we have seen a strange issue :

When I wrote in config.groovy :
cors.url.pattern = '/beer/
_' cors.allow.origin.regex='._mon.domaine.autorise([/].*)?

And started application (in dev mode and prod mode), I have tested theses
cases :

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/"
--verbose
http://sf713606.societe.mma.fr:8084/applicationBlanche/immortalCats
=> No headers in response

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/"
--verbose
http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> headers in response :
Access-Control-Allow-Origin:
http://mon.domaine.autorise/authenticationFom/
Access-Control-Allow-Origin: true

curl -H "Origin: http://mon.domaine.non.autorise/authenticationFom/"
--verbose
http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> No headers in response

==> All is good.

But we need to externalise params in config.properties; we wrote this in
config.properties and suppressed it from config.groovy :
cors.url.pattern = '/beer/
_' cors.allow.origin.regex='._mon.domaine.autorise([/].*)?

When the application starts in prod mode we have these results :

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/"
--verbose
http://sf713606.societe.mma.fr:8084/applicationBlanche/immortalCats
=> headers in response :
Access-Control-Allow-Origin:
http://mon.domaine.autorise/authenticationFom/
Access-Control-Allow-Origin: true

curl -H "Origin: http://mon.domaine.autorise/authenticationFom/"
--verbose
http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> headers in response :
Access-Control-Allow-Origin:
http://mon.domaine.autorise/authenticationFom/
Access-Control-Allow-Origin: true

curl -H "Origin: http://mon.domaine.non.autorise/authenticationFom/"
--verbose
http://sf713606.societe.mma.fr:8084/applicationBlanche/beer/show/1
=> headers in response :
Access-Control-Allow-Origin:
http://mon.domaine.non.autorise/authenticationFom/
Access-Control-Allow-Origin: true

==> It's like the plugin don't see the params and make a default
comportment. Could you test it ?

PS : We use grails 2.2 and grails cors plugin 1.1.6 and standards grails
mechanincs for properties.


Reply to this email directly or view it on GitHub
#31.

http://qdb.io/ Persistent Message Queues With Replay and #RabbitMQ
Integration

@JcrGit
Copy link
Author

JcrGit commented Nov 27, 2014

Thx ;)

@JcrGit
Copy link
Author

JcrGit commented Jan 13, 2015

Hi David, have you looked at this problem ?

Thx.

@JcrGit
Copy link
Author

JcrGit commented Jan 28, 2015

Up

1 similar comment
@JcrGit
Copy link
Author

JcrGit commented Mar 27, 2015

Up

@ctoestreich
Copy link
Contributor

Added pull request #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants