AEM SlingHttpServletResponse redirect external server

Avatar

Avatar

Eric_Stricker

Avatar

Eric_Stricker

Eric_Stricker

02-06-2020

I have a simple servlet that upload a PDF to adobe esign and I manage to get a URL back. 

 

I now want to redirect the client to this URL. The actual URL is valid if I copy-paste it into a browser, but the AEM override the below URL from 

https://secure.na1.echosign.com/.....

to 

https://my.aem.server.url/.... ==> Error "Resource at '/public/apiesign' not found

 

How do i prevent this change in URL?

 

@component(service=Servlet.class,
property={
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.paths="+ "/bin/test
})

@ServiceDescription("test")
public class test extends SlingAllMethodsServlet {

private static final Logger log = LoggerFactory.getLogger(test.class);

private static final long serialVersionUID = 1L;


@Override
protected void doGet(final SlingHttpServletRequest req,
final SlingHttpServletResponse resp) throws ServletException, IOException {
try {
.
.
.
.
.
String url = "https://secure.na1.echosign.com/public/apiesign?pid=CBFCI...U3in9aXcBSzz4pjulXWk14_14%2A&client_id=C...
log.info("Redirect url : " + url);
resp.setStatus(301);
resp.setHeader("Location", url);

} catch (Exception e) {
log.error("",e);
}
}
}

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Eric_Stricker

Avatar

Eric_Stricker

Eric_Stricker

02-06-2020

Answer my own question.

 

We use an IIS URL rewrite between the internet and Author. We found that IIS is the one updating the URL. Not AEM.

 

Tested this by calling the server directly instead of using IIS URL Rewrite.

Answers (0)