Apache "undefined" file requested - javascript

I am having an interesting error with Apache (I think Apache is the issue). I noticed many of my JavaScript files were not being served. When I went and looked at my Apache logs, I saw a whole slew of:
.... [error] File not found: /webroot/site/undefined .....
I have a strange feeling the issues are related. I am requesting the correct script src paths for sure.
Any reason why the heck "undefined" would be requested?
Additional info: PHP script, clients are embedded IE8 applications.

If you really do call the correct script URIs (“script src paths” as you say) the problem can only lie in your apache configuration.
Check your rewrite rules etc.
You may also want to check your access log, whether strange/wrong paths/URLs were called.

Related

What causes NextJS Warning: "Extra attributes from the server: data-new-gr-c-s-check-loaded... "

I'm getting the following warning from my NextJS Application:
**Warning:** Extra attributes from the server: data-new-gr-c-s-check-loaded,data-gr-ext-installed,cz-shortcut-listen
I don't know why it happens, what is the explanation for this?
This is usually caused by an extension installed in your browser affecting your application passing these extra attributes when code is executed there, most likely it is a language extension so if you have Grammarly or LanguageTool or any other extension similar, try disabling/uninstalling it.

Bug in Visual Studio 2015 package.appxmanifest for ms-appx-web in start page?

I'm creating a Javascript Windows 10 Universal app. It complained about using javascript inline with html-- due to having script tags inside my .html file.
"CSP14312: Resource violated directive 'script-src ms-appx: 'unsafe-eval'' in Host Defined Policy: inline script. Resource will be blocked."
So I did some research online and it turned out that I could avoid this error by doing two things:
Open package.appxmanifest:
add to start page:
StartPage="ms-appx-web:///index.html"
Add to package.appxmanifest:
<uap:ApplicationContentUriRules>
<uap:Rule Match="ms-appx-web:///" Type="include" WindowsRuntimeAccess="allowForWebOnly" /> </uap:ApplicationContentUriRules>
(You read this right: we need 3 slashes... ///)
Now this works great and my program is running now without the errors. But I noticed that if I change the start page via the GUI then it can't save it because it complains it's an illegal uri. So the only way I could do this was right-click the package.appxmanifest and choose "view code" and then do it through code. (Actually #2 above can only be done through code).
Maybe someone can clue me in, did I do something wrong? Here's a screenshot doing this through the GUI:
I saw a similar bug has been filed - when use the same uri format in manifest's Content URIs setting, same issue occurs. It's because the there is a rule checks whether the uri has a host. If the uri's host is null or empty, the uri validation fails.
Seems VS team is considering removing this rule, so I think it will be fixed in future release but I cannot say which update will have the fix.

.htaccess configuration for HTML5 History API

After several days of digging at the HTML5 History API, I found this great working example that suits my needs https://github.com/pinceladasdaweb/html5-history-api
However, when trying to run it on my local server/web hosting, I get an Internal Server Error, which leads me to think that there's something misconfigured in the .htacccess file.
Looked up at the Apache Error log and confirmed my theory, this was what error line tells:
"[...]
.../html5-history-api-master/.htaccess:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a
module not included in the server configuration"
I'd like to know if I need to make specific configurations in the server to make the example run properly.
You can see a working demo done by the owner here: http://www.pinceladasdaweb.com.br/html5-history-api/
Any help will be really appreciated.
Thanks!
This is what I have done to make it work.
1- As Panama Jack said in the comments, the answer of what was happening was in the log file wamp\logs\apache_error.log
[...] /html5-history-api-master/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
2- I enabled the rewrite_module on my local server (see Hardik Thaker for your visual reply to this post!
3- My web hosting is GoDaddy, I found out that I had to tweak the .htaccess file to make it work. This last post saved my life!
Hope it helps!

Random 404 from localhost

I'm running a local server in python
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
EDIT: This is the readable version of the command string passed to python -c, so in pseudocode the code block above could be resumed like this: python -c $'command' "$port" where
the command part is:
import SimpleHTTPServer
map = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map
map[""] = "text/plain"
for key, value in map.items():
map[key] = value + ";charset=UTF-8"
SimpleHTTPServer.test()
and I get (seemingly) random 404 errors that prevents my js to execute correctly.
More specifically I am serving a static html page and its linked javascript files.
Chrome tells me net::ERR_ADDRESS_UNREACHABLE and sometimes net::ERR_CONNECTION_REFUSED on this script tag on the index.html page.
<script type="text/javascript" src="http://localhost:8000/lib/fonts.js"></script>
I have 3 weird behavior I don't understand:
if I inspect the terminal log where the python server is running I don't have any 404 error. In fact it says that the file was correctly served (200).
if I go to chrome's Network panel it tells me: Failed to load response data but if I 'open link on a new tab' I can actually see the file!
If I load the file http://localhost:8000/lib/fonts.js on another tab and I refresh many times I never get errors.
sometimes I don't get any 404 errors but my js does not work at all (no js errors)
So who is causing the problem? Chrome, Python or some async behavior in my js?
I suspect that the js files are not loaded in order so other js scripts could not find and use them..
EDIT2:
If I switch server, for example using the built-in php server:
php -S localhost:8000
I won't get the errors
Ok this seems was caused by two different issues:
I've got rid of any async attributes on the <script> nodes. Especially it seems that loading jquery from google with the async attributes was causing most of the problems. Most probably the order of the scripts was not preserved but I've never got any error about jquery being undefined, I was getting an error on the missing script /lib/fonts.js weird..
Even tough removing async made things more reliable, more or less once every 10 page refresh I still got errors of the type net::ERR_ADDRESS_UNREACHABLE or net::ERR_CONNECTION_REFUSED on different external resources, sometimes on a js file, sometimes on a css file. Changing the python server with the php built-in server seems removed the remaining random errors.
So php -S localhost:8000 is more reliable (in my case) than the python counterpart.
NOTE: Even tough I've solved the problem I still don't know exactly what was causing the errors so if someone else has a better answer than this he's very welcome to post. I will leave the answer unaccepted for a while.

'Sys is undefined' error javascript error

I've tried every solution I've found through Google, and I'm currently at a loss.
I have several projects which were created for .Net 2.0 and IIS6 Server 2003 32 bit, and are being migrated to IIS7 Server 2008 64 bit (I'm new to both IIS7 and Server '08). Right now any page that utilizes .Net AJAX is getting this 'Sys is undefined error' after migration. When I view source and try to view any *.axd file, I get a 404.
I've checked that my web.config has all the appropriate sections., with all "Version" attributes set to 1.0.61025.0 since I'm not currently upgrading from .Net 2.0. The Virtual Directories are created as applications, and the App Pool is set to .Net 2.0 Integrated.
I've checked that the *.axd Handler Mappings are there and set to "Unspecified Path Type". Also there are the appropriate *_AppService.axd and ScriptResource.axd mappings.
I'm not making any custom javascript references to Sys.
I've already tried repairing/reinstalling .Net on the server, and running aspnet_regiis via the command line.
I've also tried creating "blank" WebResource.axd and ScriptResource.axd files to put them in the project. While they eliminate the 'Sys is undefined' error, it also breaks functionality within any page looking for that file.
Do I have any other options? Did I miss something else, or did I make a mistake in the steps I've already taken? Any insight you guys could provide is much appreciated. Thanks!
Removing the ScriptResource.axd Handler mapping resolved my problem once.
Also we had done this at that time,
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
</system.webServer>
Hope that helps you out (^.^)

Categories

Resources