[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-4746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Glanzmann updated MAGNOLIA-4746:
------------------------------------

    Attachment: mgnlFunctionBar.png

> "var contextPath" behind a Reverse proxy
> ----------------------------------------
>
>                 Key: MAGNOLIA-4746
>                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-4746
>             Project: Magnolia
>          Issue Type: Bug
>      Security Level: Public
>          Components: admininterface
>    Affects Versions: 4.4.8
>         Environment: Magnolia Enterprise Edition on Tomcat 6
>            Reporter: Dan Glanzmann
>            Priority: Major
>         Attachments: mgnlFunctionBar.png
>
>
> We need to run Magnolia behind a Reverse proxy
> magnolia.properties:
> {code}
> #magnolia.bootstrap.defaultBaseUrl=https://10.232.78.60/magnoliaPublic/
> magnolia.bootstrap.defaultBaseUrl=https://10.232.78.65/reverseproxy/cms/magnoliaPublic
> {code}
> Now everything except the Admin Interface AJAX calls works correctly with 
> this change:
> /.magnolia/pages/javascript.js :
> {code}
> var contextPath = '/magnoliaPublic';
> /* ###################################
> ### i18n.js
> ################################### */
> {code}
> {code:title=info.magnolia.module.admininterface.pages.JavascriptIncludePage|borderStyle=solid}
>     //...
>     public void renderHtml(String view) throws IOException {
>         HttpServletRequest request = getRequest();
>         HttpServletResponse response = getResponse();
>         PrintWriter out = response.getWriter();
>         String contextPath = request.getContextPath();
>         out.println("var contextPath = '" + contextPath + "';");
>         prepareI18n(out);
>         // finding files in classpath is too expensive, just cache the list 
> of paths!
>         String[] files = ClasspathResourcesUtil.findResources(new 
> ClasspathResourcesUtil.Filter() {
>             public boolean accept(String name) {
>                 return name.startsWith("/mgnl-resources/js-classes") && 
> name.endsWith(".js");
>             }
>         });
>     //...
> {code}
> To fix that I tried to read the DefaultBaseUrl from the config, that solved 
> the most problems (except the 4 mgnlFunctionBar images):
> {code:title=info.magnolia.module.admininterface.pages.JavascriptIncludePage|borderStyle=solid}
>     //...
>     public void renderHtml(String view) throws IOException {
>         HttpServletRequest request = getRequest();
>         HttpServletResponse response = getResponse();
>         PrintWriter out = response.getWriter();
>       
>         // String contextPath = request.getContextPath();
>         // get URI from "magnolia.bootstrap.defaultBaseUrl"
>         String defaultBaseUrl = 
> ServerConfiguration.getInstance().getDefaultBaseUrl();
>         String contextPath = URI.create(defaultBaseUrl).getPath();
>         out.println("var contextPath = '" + contextPath + "';");
>     //...
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to