Message Boards

Delegate don't working with https

Jose Antonio Campos Segura, modified 3 Years ago.

Delegate don't working with https

Junior Member Posts: 45 Join Date: 9/30/17 Recent Posts
In my portlet I make use of delegates to obtain json data from a servlet, when I deploy the portlet in a development environment that is served over http, the requests are made correctly, however, when I deploy the portlet on a machine with https, the requests to the delegate redirect me to the home page.
/delegate/data/mydatas => returns json data
What could be the problem?

Thank you.
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Delegate don't working with https

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Jose Antonio Campos Segura:

In my portlet I make use of delegates to obtain json data from a servlet, when I deploy the portlet in a development environment that is served over http, the requests are made correctly, however, when I deploy the portlet on a machine with https, the requests to the delegate redirect me to the home page.

Do you have a reverse proxy? If you serve https on the reverse proxy, but forward on http, Tomcat/Liferay has no clue that you're actually using https, because it never sees it. For Tomcat, you can configure the connector. Or where you build the URL for accessing the service, you can just explicitly use https.
Jose Antonio Campos Segura, modified 3 Years ago.

RE: Delegate don't working with https

Junior Member Posts: 45 Join Date: 9/30/17 Recent Posts
Load balancers are used and I don't know the configuration of the corporate servers. The code I am implementing as an example is
https://github.com/digirati-co-uk/liferay-atlas-portlet
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Delegate don't working with https

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Jose Antonio Campos Segura:

Load balancers are used and I don't know the configuration of the corporate servers. The code I am implementing as an example is
https://github.com/digirati-co-uk/liferay-atlas-portlet

That points to something else: I haven't looked long enough to identify how you create the URL, but in the OSGi world we're not deploying separate web applications with their own URL-space any more. E.g. you might need to update the URL to be specific to the paths that the OSGi container can parse (typically they start with "/o/").
I'd recommend to check the various blade samples (e.g. you're using servlets in that plugin). But most likely the URL, under which you access your resources, will change.
Jose Antonio Campos Segura, modified 3 Years ago.

RE: Delegate don't working with https

Junior Member Posts: 45 Join Date: 9/30/17 Recent Posts
What seems strange to me is that in a test environment that serves the web in http without securing it.
If I type in the browser :
http: // miserver / delegate / data / digirati  this paints the result in Json format in the browser.
However if I do the same request on another machine that serves the web in
https: // miserver / delegate / data / digirati, I get a redirect to https: // miserver /
I am working on LR 6.2
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Delegate don't working with https

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
If you're in 6.2, forget about the /o/ URL path that I talked about. But consider to upgrade sooner rather than later.
As you say that Loadbalancers are in use (odds are that there might be webservers/reverse proxies as well), I'd check for their handling of those URLs and if they reach the appserver at all. Often the HTTP path is configured differently than the HTTPS path, so they might be missing something. You could validate that the request reaches Tomcat (or whatever appserver you're using) by inspecting its access logs. If the redirect does not appear in there, you know that the cause (and solution) lies upstream