Issue in hosting a webapplication in a local machine - apache

I have developed a webapplication in my local machine. the application is hosted on tomcat 7.0.22 server. the application is accessed using http://localhost:8080/app
When i use this in my localmachine, I am not facing any problems. But when I intend to share the link with my fellow team mates using the links http://myipaddress:8080/app, I am getting Javascript errors. I placed the js files in the build path of the application.
Even i have noticed the tables width are changed in the same browser
I am unable to find the problem. Can any one help
Thanks,
Vamsi

When testing on your own machine, use your own IP instead of "localhost" and should be able to compare apples with apples and avoid confusing cause and effect.
I would say to check the configuration of your host or vhost files, but if all included JS files are on the same host, that is unlikely to be the problem.
My guess is that you hard coded a path somewhere or that the problem is related to some other difference between testing from your machine and their machine (different browser, versions, plugins, etc) and not actually related at all to the domain. Could possibly also be a file permission problem (but that is a wild guess).

Related

Browse Verdaccio UI by Hostname or IP

I have installed Verdaccio under Ubuntu.
Packages are published and accessible.
The machine is accessible via two different aliases, as well as via IP address.
When I now open the Web UI of Verdaccio, the published packages are only displayed in the first one called (e.g. npm.xxx.com). If I then open the Web UI by calling the IP address or the other alias, the info appears that no packages have been published yet and the previously used URL (npm.xxx.com) is displayed as the registry.
I have tested both with and without reverse proxy, the behaviour is the same in both. The Proxy got all serverAlias as well as the IP adress.
The service only runs once, if it is stopped, all calls fail.
Also, there is only one config file and if you change the appearance of the web UI, this change is displayed for all calls.
How can I make it so that no matter which URL is used to call up the Web UI, the existing packages are displayed?
Cheers
Anjs
I think is not possible at this point, there were some discussions like here
https://github.com/verdaccio/verdaccio/discussions/3474#discussion-4541243
If you open dev tools, the browser expects to serve them in a specific domain and you don't see packages because JS fails on load, independently if is right or not behavior is open t discussion, just is how it is now.
Probably there are more, I've replied to the same question a few times. The recommendation is to use one domain at this point.

How can I use a path to a directory on linux in XWiki?

I would like to put a path to a file on an XWiki page.
For a Windows file share this works:
[[For Windows>>unc://filehare/directory$/index.html]]
For linux:
When I enter file:///mnt/directory/index.html in Firefox, the index.html page is displayed.
But when I use any of these syntaxes in XWiki, nothing happens.
[[For Linux>>file:///mnt/directory/index.html]]
[[For Linux>>file:mnt/directory/index.html]]
[[For Linux>>file:/mnt/directory/index.html]]
[[For Linux>>unc:mnt/directory/index.html]]
[[For Linux>>unc:/mnt/directory/index.html]]
[[For Linux>>unc:///mnt/directory/index.html]]
Can anyone tell me what the correct syntax is?
First of all, you need to clearly understand the fact that the UNC protocol (and links using it) is used to address/reference files on other computers in your local network only. They can also be links to your own computer (using your computer's "name", but most of the time they refer to other computers). Some more details about UNC: https://whatis.techtarget.com/definition/Universal-Naming-Convention-UNC
Second: It is not clear what you mean by "on Windows" vs "on Linux". Is the XWiki server running on Windows in the first case and, in the second case it is a different XWiki server that is running on Linux? What I actually think you mean is that you tried to access the same XWiki server from 2 different computers: first you were using a computer with Windows operating system (possibly on Internet Explorer/Edge) and in the second case you switched to a different computer that was running a Linux distribution with the Firefox browser. I will assume you are in this latter situation, as it is the one that makes most sense. Please note that UNC links will only work for people that are using a Windows computer when viewing the XWiki page.
Third: Your first example unc://filehare/directory$/index.html is a reference to a file on the fileshare computer (which is somewhere on the Network, other than the current computer you are using right now to test, referenced with the UNC protocol mentioned in my first point). However, your second example file:///mnt/directory/index.html, which is not working, is a reference to a file that is on your local computer, the one you are testing with ("mnt" is a folder on your computer). In this second example, your particular usecase is no longer allowed since a good couple of years ago by modern web browsers (including Firefox, the browser you are testing with) because of security problems. Internet Explorer (being an old browser), might still work by default, but you should not really be using it in 2018 anymore. Feel free to read more about this subject on http://kb.mozillazine.org/Links_to_local_pages_don%27t_work
In XWiki, any of the following links are equivalent:
[[UNC file on the "server" computer>>unc:\\server\folder\file.ext]]
[[UNC file on the "server" computer>>url:file://///server/folder/file.ext]]
[[UNC file on the "server" computer>>file://///server/folder/file.ext]]
...however, is not really something related to XWiki, but to the capacity of your current browser to interpreting those links. By default, as said, this is no longer supported or simply disabled. Some browsers might still support disabling this protection, either by some advanced setting or by installing a browser add-on:
Chrome: https://chrome.google.com/webstore/detail/enable-local-file-links/nikfmfgobenbhmocjaaboihbeocackld?hl=en
Firefox: https://addons.mozilla.org/en-US/firefox/addon/noscript/
...but you would have to do this change and install this type of add-ons on all the computers that you wish to use when reading that page, which is not very practical.

How to make use of common files across projects using an IIS7 virtual directory

The scenario:
I'm very new to ASP.Net MVC programming and running into a wall constantly trying to make use of common files (.js, .css) across multiple projects.
The idea is to have these generic files in 1 location which provides for easy future updates and avoids the "copy and paste" dilemma across all the projects. I've set this folder up in IIS7 as a virtual directory in the default website with an alias "CommonFiles".
The problem:
With MVC-4 I'm trying to add the js files to a script bundle but upon running the application it's not picking the files up at all. (checked in the page source and also added a js function as a test)
Code snippet in BundleConfig.cs:
bundles.Add(new ScriptBundle("~/bundles/test").Include("~/CommonFiles/test.js"));
Rendering in _Layout.cshtml:
#Scripts.Render("~/bundles/test")
I've read quite a few posts (
Script Bundling in WebForms with Virtual Directories (asp webforms though), How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app, ScriptBundle not rendering scripts that are in a VirtualDirectory) but i'm afraid my lack of knowledge on MVC is limiting my path forward and really hoping to get some insight into how MVC handles IIS virtual directories and if it's even an easy possibility given the last post i've read above.
Can this be done in MVC-4 and if not what is a second best alternative in reusing common code across projects?
After reading a post by kev (Using ServerManager to create Application within Application) it put me on the right path and the issue I had is actually embarrassing.
For the sake of other devs landing on this post with a similar issue in visual studio, this is what fixed my issue:
Problem:
I make use of a separate project which contains files that are used across multiple other projects. I created a virtual folder in IIS7 referencing these files. This means if a change is needed to the common files, it's updated once and all the other projects will automatically "see" the change.
My other individual projects make use of script bundling to include files relevant only to the said project, but also to reference the common files in the virtual folder as defined in IIS.
My MVC-4 web application wasn't picking up the common files given the syntax above, in neither debug or release..
Solution:
When developing in VS2012, under the project's properties, there's a setting under the web tab where you can specify whether you want to use local IIS web server or IIS Express to test your application. IIS Express adds a random port to the site in order to test, and to allow multiple instances of sites to run (on different ports). This seems to throw the virtual directory include off in the bundling.
Choosing to use the local IIS server is closer to what the "live" environment would be in my opinion. Just un-tick the "Use IIS Express" setting.
As a side note and for more info on what the difference between the usage of IIS and IIS express is and whether it's suitable for your environment (as it was for mine) see this link:
http://msdn.microsoft.com/en-us/library/58wxa9w5.aspx
Hope this helps someone in future and saves them the amount of time I wasted on this!

"Hack" in to localhost root directory from a VM web app

I have apache VM web app running locally. It's red hat.
It's PHP based but the main page is index.html. I am able to to into sub-directories for images and such, I wanted to know if it is possible for me to gain access to the directories that contain the php code, probably just one level above the images directory. Because of index.html, it forces the load, and I am unable to see server files.
Yes there used to be a trick called dot-dot-traversal that could do this. Basically you put two dots into a URL and climb above the web root. Something like http://www.example.com/../../../../etc/shadow . Occasionally a new way to exploit the vulnerability is discovered, but mostly it is rare. Unless you're running an old server, you should be pretty safe.

Ubuntu Lucid, cgi-bin, and MathTex

So I have several dedicated servers out there running Ubuntu Lucid server. They primarily run WordPress sites - LAMP. However, one of my original sites is a controls engineering site that uses MathTex to render the equations.
MathTex is pretty hard on servers. The engineering site is still hosted on the original VPS which runs something like CentOS (but that's irrelevant). The traffic and numbers of renderings that MathTex creates cause resource issues with my VPS. I've been able to allocate more resources to the VPS but ultimately this gets expensive. So I'd like to offload the equation rendering to my dedicated servers all of which are much more powerful and under-utilized.
So I've followed the instructions on installing and compiling MathTex. And MathTex works fine from the command line. However, when I attempt to call the script via my browser the browsers all try download the cgi file (I've tested on Firefox and Chrome on 2 machines).
This led me to attempt to compile and install on my home Ubuntu box that is Ubuntu desktop. The command line works fine. However, again when calling the function in my browser it wanted to download the file instead of rendering an equation. So I moved the mathtex.cgi script to /usr/lib/cgi-bin. Still no go. Then I changed /usr/lib/cgi-bin to 777 and it worked. I changed /usr/lib/cgi-bin to 755 and it stopped working.
So my home box works when /usr/lib/cgi-bin is 777. I tried that one of my dedicated Ubuntu servers and still no go. My browser still attempts to download the file.
The directive for Apache to find the cgi-bin directory is in /etc/apache/site-available/default. And at a quick glance they appear to be identical (I haven't yet studied every character).
FYI
I got some help from my hosting company. They are generally pretty good but this is outside the scope of what they provide for free. So when I was switching servers I had a couple of password issues and managed to tack this question on as well.
The support person finally got the mathtex.cgi script to run by creating a /cgi-bin under the domain's folder. Making that folder 777 and adding an AddHandler cgi-script to the http.conf. Then he restarted Apache2.
I had been putting mathtex.cgi under a generic /cgi-bin directory that I had intended to share among all the domains as needed. And this generic /cgi-bin directory appeared to be what the MathTex installation instructions were suggesting.
Hope this helps someone else.