ijokarumawak commented on issue #211: NIFIREG-295 Add support for proxying via 
Apache Knox
URL: https://github.com/apache/nifi-registry/pull/211#issuecomment-521483420
 
 
   Rebased with the latest master. I think I understand why I'm still seeing 
the warning message.
   
   > Resource interpreted as Stylesheet but transferred with MIME type 
text/html: 
"https://nifi-registry:18443/nifi-registry/administration/vendor.min.14dc6f3729ebc0fec9e2.css";.
   
   When NiFi Registry Web UI is accessed from a browser, following HTML is 
returned (which is derived from template.html):
   
   ```html
   <html>
   <head>
       <title>NiFi Registry</title>
       <script type="text/javascript">
           var pathname = document.location.pathname;
           var appRootIndex = 
document.location.pathname.indexOf('/nifi-registry/');
           var base = document.createElement('base');
           base.setAttribute('href', document.location.pathname.substring(0, 
appRootIndex) + '/nifi-registry/');
           document.head.appendChild(base);
       </script>
       <meta charset='UTF-8'>
       <meta name='viewport' content='width=device-width, initial-scale=1'>
       <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
       <!-- Styles will be injected here by webpack -->
   <link rel="shortcut icon" href="registry-favicon.png"><link 
href="vendor.min.14dc6f3729ebc0fec9e2.css" rel="stylesheet"><link 
href="nf-registry.style.min.2bc4be4717d8b764b9ba.css" rel="stylesheet"></head>
   <body>
       <nf-registry-app></nf-registry-app>
       <!-- Scripts will be injected here by webpack -->
   <script type="text/javascript" 
src="vendor.min.e33e47d8e9966542cb4a.js"></script><script 
type="text/javascript" 
src="nf-registry.bundle.min.236c34497ded3ce25502.js"></script></body>
   </html>
   ```
   
   Then, browsers (I tested Chrome and FireFox) do followings:
   1. Loads external resources, CSS and JS in this case, using the `href` that 
is a relative link from current URL. For example, if user hard reloads 
(Shift+Ctrl+R) `https://nifi-registry:18443/nifi-registry/explorer/grid-list`, 
browser sends a GET request to 
`https://nifi-registry:18443/nifi-registry/explorer/grid-list/vendor.min.14dc6f3729ebc0fec9e2.css`.
 But the resource is not found, so HTML is returned, then browser logs the 
warning message.
   2. After that happens, the script block is evaluated, and adds `<base 
href="/nifi-registry/">`.
   3. Browser reloads external resources once again. This time using 
`https://nifi-registry:18443/nifi-registry/vendor.min.14dc6f3729ebc0fec9e2.css` 
successfully. I confirmed 2 GET requests sent for each CSS.
   
   @rfellows @mcgilman Do you have any solution to handle this? A possible one 
would be changing how webpack inject the resource links. For example, injecting 
a script block that will add 'link' and 'script' tags dynamically after the 
'base' tag is added, so that the relative paths are evaluated correctly. I 
don't know where to change to do that, though...  How do you think?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to