Home Grails. Redirect not working after CURL call from remote server
Reply: 1

Grails. Redirect not working after CURL call from remote server

Marcos Fernandez
1#
Marcos Fernandez Published in 2017-12-04 09:27:13Z

I HAVE EDITED THE QUESTION TO SIMPLIFY IT

I have an app working in a domain like this:

http://localhost:8092/myapp

If I access to

http://localhost:8092/myapp/ticket/save

with a browser, everything goes fine. However, if I make a CURL call from command line to another controller, and from there I try to redirect to the controller "ticket" method "save", as shown in the URL above, it works only if the call is made from localhost. But if I made the call from a remote server it won't do anything.

This is the curl call:

curl --location http://192.168.1.18:8092/myapp/trans/index

and the index method:

def index() {
    print "index"

    redirect(controller: "ticket", action:"save")
}

When making the call from a remote client, Grails won't do the redirection and it does not show any error. However, in the terminal, it says:

curl  --location  http://192.168.1.18:8092/Post-editor_Grails/traduccion/index
curl: (7) couldn't connect to host

BUT the call does reach the server, as "index" gets printed in Grails console. So I asume that error comes from the redirection.

I have tried to set absolute:true in the redirect, as shown here:

Grails redirect with reverse proxy

but it does not work either.

Any ideas?

Marcos Fernandez
2#
Marcos Fernandez Reply to 2017-12-04 12:33:48Z

Nah, forget this question. In Config.groovy I had:

grails.serverURL = "http://localhost:8092/${appName}"

Just need to change localhost to 192.168.... (it needs the "absolute:true" though)

I don't know if I should delete the question

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.323057 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO