Grails test-app -https - grails

i've just upgraded my app to grails 2.3.4 and i'm implementing Cucumber and Geb test in order to keep it all covered.
The problem is that one of the requirements of the application that should only listen secure connections (https) so i added in config groovy
grails.plugin.springsecurity.auth.forceHttps = "true"
grails.plugin.springsecurity.secureChannel.definition = [
'/**':'REQUIRES_SECURE_CHANNEL'
]
Now, the problem is when i run grails test-app -https, is not working the param -https and only starts the application in non-secure channel.
Any ideas to run test-app in https?
Thanks in advance

Seems to be a Grails bug. I have submitted a pull request and also added a comment to this question.

Related

Spring Security in Grails redirects to IP after login

I am running a Grails 2.4.2 app in a Tomcat 7 for ubuntu.
I have the problem that after login, page is redirected to IP.
Before login
www.app.com/login
After login
104.21.22.23/login
I tried to configure grails.serverURL but that did not make any difference. My current value for grails.serverURL is "www.app.com"
in answer, I am considering you are using grails 2.4.2
In your BuildConfig.groovy file add following:
grails.plugin.springsecurity.successHandler.alwaysUseDefault = true
grails.plugin.springsecurity.successHandler.defaultTargetUrl = '/YOUR_APP__URL'
above will work with latest version of grails also.
You can check all options here

I can't stop a grails application (3.2.8)

I start a grails application (3.2.8) with "grails run-app". It takes the defaults and start at "http://localhost:8080".
From IntelliJ, or even from the windows terminal I invoke "grails stop-app" and I get the following message:
| Application not found via JMX, attempting remote shutdown.
| Shutting down application...
| Error Application not running.
In application.groovy I added:
grails.project.fork.run = true
with no effect.
What is the right way to stop the server? I particularly need it when I set dbCreate = 'create-drop' to clean the database.
Do you have this in your build.gradle?
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
addResources = true
}
Otherwise do you have a g:include? Could be this issue:
https://github.com/grails/grails-core/issues/10411
I see this with the simplest of apps in 3.3.3. I tracked it down to permissions on the Spring Boot "shutdown" endpoint. I fixed it by adding the following to grails-app/conf/application.yml:
management:
security:
enabled: false
Since this works, I assume "grails stop-app" is essentially doing this:
curl -X POST localhost:8080/shutdown
I'm new to Grails, so there may be a better solution that doesn't require dropping down to the Spring Boot level.

Grails 3 app is 404 in JBoss EAP 6

If I create a new web profile app, and generate-all, it runs fine in my local and deploys without error to JBoss. But when I try to access the app all URLs return 404. I know the app started up successfully, because it created tables in the database.
Here's what I'm doing.
grails 3.1.4> create-app demo
create-domain-class Book
create-domain-class Author
Edit domain classes
generate-all *
change tomcat dependency from compile to provided in build.gradle
change dataSource in application.yml to use my JNDI Oracle connection
Add server: contextPath: /demo to application.yml
run-app -> Works
gradle war
Deploy to JBoss EAP 6.4.0.GA
JBoss says deployment and activation of the app was successful. There are no errors of any sort in any JBoss log file. And dbCreate: update made the DDL changes to my Oracle database, so I know it got that far. But all URLs for the app return 404.
This is a known bug: Issue-9481
It has been added to grails 3.1.5 milestone.

Grails 2.5.0 endpoints located sans application context

I am upgrading an existing Grails 2.2.4 app to 2.5.0.
For some reason, endpoints whose URLs included the app context in 2.2.4 no longer include the app context in 2.5.0.
e.g., for app context = app, old endpoint in 2.2.4 was:
/app/a/b/c
but in 2.5.0 is now:
/a/b/c
I have tried many things to fix this, including:
in application.properties:
app.name=app
app.context=/app
in Config.groovy, for testing on localhost:8080:
grails.app.context = "/${appName}"
grails.serverURL = http://localhost:8080 and grails.serverURL = http://localhost:8080/${appName}, at different times
app.grails.serverURL = http://localhost:8080 and app.grails.serverURL = http://localhost:8080/${appName}, at different times
I've verified that "${appName}" == 'app'.
I have upgraded all of the plugins to the newest version, but I'm continuing to use the resources plugin instead of the asset-pipeline plugin.
I am not using scaffolding.
Any suggestions?
UrlMappings.groovy contained some mappings with (parseRequest:true), which is no longer supported by Grails. Removing that fixed it.

Does Grails run the Bootstrap.groovy script when deploying the app as a war?

Bootstrap executes fine during run-app (database is seeded). But it doesn't appear to get invoked when Tomcat deploys the war (nothing in the database).
Does the Bootstrap get run during war deployment? If not, is there a way to make it run?
Specifically I am wanting my sample data to seed the database.
Yes it does....
i would look to make sure you have your environments configured properly if you see thing working in development, but not production

Resources