[MAGNOLIA-4746] "var contextPath" behind a Reverse proxy Created: 20/Dec/12 Updated: 04/Aug/15 Resolved: 04/Aug/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | admininterface |
| Affects Version/s: | 4.4.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Dan Glanzmann | Assignee: | Unassigned |
| Resolution: | Outdated | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Magnolia Enterprise Edition on Tomcat 6 |
||
| Attachments: |
|
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
We need to run Magnolia behind a Reverse proxy magnolia.properties: #magnolia.bootstrap.defaultBaseUrl=https://10.232.78.60/magnoliaPublic/ magnolia.bootstrap.defaultBaseUrl=https://10.232.78.65/reverseproxy/cms/magnoliaPublic Now everything except the Admin Interface AJAX calls works correctly with this change: /.magnolia/pages/javascript.js : var contextPath = '/magnoliaPublic'; /* ################################### ### i18n.js ################################### */ info.magnolia.module.admininterface.pages.JavascriptIncludePage //... 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"); } }); //... To fix that I tried to read the DefaultBaseUrl from the config, that solved the most problems (except the 4 mgnlFunctionBar images): info.magnolia.module.admininterface.pages.JavascriptIncludePage //... 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 + "';"); //... |
| Comments |
| Comment by Michael Mühlebach [ 04/Aug/15 ] |
|
We're closing this issue as outdated as it was reported for 4.4.x or earlier versions which are no longer supported. Don't hesitate to reopen or create a new ticket in case this is still relevant and you'll experience it on 4.5.x or later versions. |