James S
James S

Reputation: 41

Grails Spring Security appending :8080 to URL when behind Apache proxy

In production my Grails app is running on Tomcat port 8080 and sits behind an Apache proxy; port 80. All functions work except for authentication. When a user tries logging into the app Spring Security appends :8080 to the target URL and the connection times out since the request can't be routed.

I have already set the following in config.groovy but no success:

    grails.serverURL = "http://domain.tld/${appName}"
grails.plugins.springsecurity.portMapper.httpPort = "80"
grails.plugins.springsecurity.portMapper.httpsPort = "443"

The issue occurs when I try with either built-in authentication or OpenID. The app had been working well for over 6 months before my hosting provider made changes by plugged a hole and started blocking port 8080 from the outside.

I just need Spring Security to write the URL without :8080

Any help is appreciated, thanks!

UPDATE In the end the issue was with the host I was using. Something to do with Apache ProxyPass. The same application works fine on the new production VPS. Thanks for the input guys.

Upvotes: 2

Views: 1364

Answers (3)

sujaisd
sujaisd

Reputation: 183

Already answered in the question

mod_rewrite not working to secure grails application

The tomcat configuration change works like a charm.

Upvotes: 0

Tal
Tal

Reputation: 194

I would consider change tomcat to port 80 and forward all apache requests to port 80. Pay attention to use x-forward proto header tag by spring security.

Upvotes: 0

grantmcconnaughey
grantmcconnaughey

Reputation: 10699

Add the following to your Config.groovy file:

grails.server.port.http = 80

Upvotes: 1

Related Questions