Grails application behind https - grails

I've been playing with Grails for few months and I've just build my first app. Can someone tell me how to put my grails application behind https? I used Grails 1.3.7, Spring Security Core 1.2.7.2 and deployed it on Tomcat 7. If you need more info please say so.

If you're just using Tomcat you'll need to install an SSL cert for Tomcat. The details of that process are too lengthly, IMHO, for SO. Especially when the information is readily available on the web:
Install SSL Cert
You can also run it locally during dev in https mode by appending -https to your run-app command.

Related

How to configure(SSL) self signed certificate in Alfresco 6.2 test environment after docker based installation?

I have installed Alfresco 6.2 using docker based installation and it's working fine with http.
Now, I have to run same set-up on https and i have to apply self signed certificate for this.
Can someone please provide the steps to generate this self-signed certificate and how to apply it inside docker image.
Any help will be appreciated.
I already did same thing for Alfresco 5.2 without docker, but here I am quite new to docker and not understanding how to do this.
Instead of changing the tomcat certificate I would recommend to setup SSL on nginx or any other reverse proxy. The Tomcat certificate is also used to authenticate Solr. Configuration errors can easily cause the search to stop working.
When using a reverse proxy don't forget to set your external connection in alfresco-global.properties to avoid problems with the CSRF Token Filter. e.g.:
alfresco.context=alfresco
alfresco.host=alfresco.mycompany.com
alfresco.port=443
alfresco.protocol=https
share.context=share
share.host=${alfresco.host}
share.port=${alfresco.port}
share.protocol=${alfresco.protocol}

3.0.0.M1 how to run on https connection

Trying Grails 3.0.0.M1, a lot has changed!
How would I run-app --https and how would I configure it that way also for the production-environment-war?
Many thanks!
First of all, Grails 3.0.0.M1 is not production ready, if thinking about making the move.
Major changes for Grails 3 include:
Built on top of Spring Boot
Introduction of Gradle as the build system
And many more (which is not relevant to this question)
In order to setup SSL for Spring Boot app, server.ssl.* setting has to be added to application.properties or application.yml file.
In Grails 3 it would correspond to application.yml under grails-app/conf. Below changes (as an example) would be required:
server:
port: 8443
ssl:
key-store: classpath:keystore.jks
key-store-password: secret
key-password: another-secret
which is equivalent to Configuring SSL in Spring Boot.
However, documentation is limited right now and is being worked on. So let Grails 3 brew more until its GA where it can be used in production environment.
Grails community will be more than happy if any issues/problems/enhancement is reported in Grails JIRA

How to solve cross domain errors when running two grails apps on localhost

I am trying to run-app my project with other wars/wars also running. So for example we have a war/ear that has legacy web services that I would like to access. My goal is to deploy those existing wars/ears with my run-app. I can deploy both separately, as grails run-app on port 8081 and jboss on port 8080. The problem was when I tried to do a ajax POST, DELETE, or PUT I get a cross-domain error because each app is on its own port. Is there a way to use run-app so that my grails project is at localhost:8080/grails and the webservices are at localhost:8080/webservices
Env: Grails 2.1.1
Server: Jboss (perfered) or vFabric tc Server (by dropping in existing war/war)
I don't believe that you can "run-app" both projects on the same port because you're running an embedded container. However, what you can do is check out the Grails CORS plugin which will allow other domains to access your grails app during run-app or otherwise.
http://grails.org/plugin/cors

How to make GlassFish web server use JRuby on Rails?

I installed Ubuntu, GlassFish web server, installed JRuby on Rails using GlassFish's admin tools, deployed my application from .war archive. The problem is only - when I attempt to run this web application nothing happens. GlassFish isn't listening on port 8080 as promised. The GlassFish administration web console listens on port 4848 and works fine. What to do to pair GlassFish and JRuby on Rails the correct way, remembering that it isn't a separate JRuby installation?
Update: it seems that this problem lies somewhere around access rights because I can deploy an application through
sudo ./asadmin deploy
but can not do the same through web console. The output is as if the application has been deployed, without any error messages (web interface shows the presence of application, domain folder contains my application's file/folder structure), but something in server's internals isn't bound to application.
I didn't think much and applied quick and dirty solution: set "777" access rights to /home/glassfish and all its contents. It helped.

how can i convert my grails application from http to https under Linux operating system?

how can i convert my grails application from http to https under Linux operating system
the configuration depends on what container you are running the application in your production environment. You should be deploying a war to your Production Server not doing a grails run-app -https
here is a stackoverflow question with a configuration for Tomcat.
I am certain you can google around and find proper configuration based on your application server
What do you mean by "convert"?
You can run the embedded tomcat with HTTPS enabled by adding -https to the run-app command:
grails run-app -https
If you want HTTPS enabled in production then you need to configure your app server to support it.

Resources