Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Blank login form(js won't load because of mismatched MIME type )
Blank login form [message #1831384] Tue, 18 August 2020 21:00 Go to next message
Marco Dörfliger is currently offline Marco DörfligerFriend
Messages: 46
Registered: January 2015
Member
I'm implementing a login form in my scout 10 application, and I'm having a problem getting the login form to load.

After the app starts, I connect to localhost:8082 and I get a blank page. When I inspect the source, the login.html has loaded but my firefox dev console reports the error message
Quote:
The resource from "http://localhost:8082/login.js" was blocked due to MIME type ("text/html") mismatch (X-Content-Type-Options: nosniff).
Have you encountered this issue before?

Looking at login.html, the login.js is loaded using a custom tag <scout:script src="login.js" />. Is there any way to explicitly set the mime-type on this? Would that even help?

This can be reproduced on chrome and firefox using a vanilla scout 10 (10.0.21) helloworld app by just disabling or commenting out all of the access controllers in UiServletFilter.java.

Cheers,
Marco
Re: Blank login form [message #1831403 is a reply to message #1831384] Wed, 19 August 2020 06:09 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
I guess the Content-Type is wrong. In my case I have this response header for login.js:

Content-Type: application/javascript;charset=UTF-8

On both, deployed application on a Tomcat and on a Jetty server while developing locally.

Can you check what the response header says on your machine?

Then I'd suggest to debug into the class "org.eclipse.scout.rt.ui.html.res.ResourceRequestHandler" and check how the loaded resource for login.js looks like (See screenshot below).

Cheers
André







Eclipse Scout Homepage | Documentation | GitHub
Re: Blank login form [message #1831404 is a reply to message #1831384] Wed, 19 August 2020 06:29 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 214
Registered: November 2010
Senior Member
Marco Dörfliger wrote on Tue, 18 August 2020 21:00

After the app starts, I connect to localhost:8082 and I get a blank page. When I inspect the source, the login.html has loaded but my firefox dev console reports the error message
Quote:
The resource from "http://localhost:8082/login.js" was blocked due to MIME type ("text/html") mismatch (X-Content-Type-Options: nosniff).
Have you encountered this issue before?


This can happen when the login.js file cannot be found. In this case, Jetty (or Tomcat, or whatever app sever you are using) returns a HTTP 404 status along a human readable HTML page. You can verify this by entering the full URL to the login.js in the address bar of your browser. If you get a 404 message, you have to verify that the generated files are at the correct location (i.e. your webpack build is running). The generated file should be present at your.project.ui.html\dist\dev\login.js in development mode (or your.project.ui.html.jar!dist/prod/login.js in the production build).

Regards,
Beat
Re: Blank login form [message #1831407 is a reply to message #1831404] Wed, 19 August 2020 07:27 Go to previous message
Marco Dörfliger is currently offline Marco DörfligerFriend
Messages: 46
Registered: January 2015
Member
Ok, found the issue. I actually stated the cause in my initial post:
Quote:
disabling or commenting out all of the access controllers in UiServletFilter.java.


That's the problem: it tries to access the login page, but since I'd set
		m_trivialAccessController = BEANS.get(TrivialAccessController.class).init(new TrivialAuthConfig()
				.withExclusionFilter(filterConfig.getInitParameter("filter-exclude"))
				.withLoginPageInstalled(true).withEnabled(false));

when it requests login.js, that request is redirected to login.html (which apparently isn't javascript). :)

At least, I presume that is the case, as it now works. Thanks for the replies though, the idea about getting a 404 error put me on the right track.

It's a pretty basic mistake, but one easily made. I wanted to disable other forms of authentication, but in actuality the TrivialAuthConfig is what provides access to necessary login resources, so it shouldn't be disabled.
Previous Topic:Strange Visuell Bug
Next Topic:Proxy support in development
Goto Forum:
  


Current Time: Fri Dec 06 14:23:50 GMT 2024

Powered by FUDForum. Page generated in 0.27541 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top