Opencms change directory of site - opencms

I have opencms 10.5.4, tomcat 8.5.37.
I have a site "localhost:8080", now i have to move the site to "localhost:8080/mydirectory"
I tried to change opencms-system.xml
<sites>
<workplace-server>http://localhost:8080/mydirectory</workplace-server>
<default-uri>/sites/default/</default-uri>
<shared-folder>/shared/</shared-folder>
<site server="http://localhost:8080" uri="/sites/default/" title="Demo Site" position="3.4028235E38" webserver="true">
<parameters>
<param name="locale.main">it</param>
<param name="locale.secondary">en</param>
</parameters>
</site>
</sites>
I restarted catalina but nothing happens.
What is the best way to change domain url without breaking the links of the css and files that are in the modules?

I am not sure what you want to achieve. If you just want to access your website through an additional folder to let's say distinguish from other sites you could just create a folder within the OpenCms workplace and move all your content to that folder.
Create the folder in the root directory of your site (e. g. /sites/default/mydirectory/).
Changes to opencms-system.xml are not necessary for this. So please remove mydirectoryfrom your workplace-server configuration.
HTH
Best regards
Kai

Related

IIS custom site HTTP Error 401.3 - Unauthorized

I've created a new site within IIS and pointed to my local Documents directory
C:\Users\name\Documents
via
http://localhost:8080/
The error I'm getting is
HTTP Error 401.3 - Unauthorized
I've checked the properties of the Documents folder under Security. for IIS_IUSRS, Read & Execute, List folder contents and Read are checked.
Others like SYSTEM, myUsername, Administrators have more rights to this folder.
Not sure what I'm missing here, please advise.
Download Procmon from here and start tracing. Reproduce the issue and stop procmon.
Filter procmon trace for "access denied". It'll tell you what permissions are needed and for which folder.
Share a screenshot of procmon trace if you find it difficult to analyze and I will try and guide you.
"C:\Users\name\Documents" would typically be a terrible place to put a web site. It is essentially the same as "My Documents" which is a special Windows folder. And it would have a number of non-web site folders. Try using C:\Web (or something like that) and add IIS_IUSRS to that folder.
BUT, if you really want to use your My Documents as the root of a web site, you can create a web.config file in C:\Users\name\Documents with the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authentication mode="None" />
</system.web>
</configuration>

How to forward to Lightswitch html client from domain root deployed on Azure Websites

I have successfully deployed a Lightswitch HTML application to Azure Websites. I have also forwarded my personal domain to mask the azurewebsite.net address. I am now able to access the site by typing mydomain.com/htmlclient and everything works fine. If I type in just the my domain.com, however, I get the you do not have permission error.
This is close but ultimately I would like to be able to enter just the domain and have it automatically forward to the htmlclient folder. I know it is possible but I'm not sure if I can get there with settings in azure or my domain host or if I have to drop a page in the root (it appears that the default and login.aspx pages for forms authentication are already in the root).
Any help would be appreciated.
In the Visual Studio 2013 version we've found this is simply a case of adding an additional entry to the LightSwitch server project's web.config file.
This additional entry needs to reference the default.aspx file (which should already be part of the server project) and should be introduced into the defaultDocument section of the web.config. In the following example, this new line appears immediately after the standard default.htm line: -
<defaultDocument>
<files>
<clear />
<add value="default.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>

How do I prevent direct access to documents in GlassFish?

I have a directory on my site with PDF files, each file is named using the ID of it's record (i.e. 12345.pdf, 67891.pdf).
I want to prevent a user from access PDF files directly by simply typing in the URL of a file. I want to force the user to use a page script to access the file (e.g. /getFile?12345, where the getFile script would retrieve the file and display).
I know using Apache you can modify the htaccess file to restrict direct access for certain file types, but I'm using GlassFish 3.1.2 and, being relatively new to it, I can't find anything about accomplishing something similar. Anybody know how to do this?
I'm dealing with exact issue right now and I have a solution that works (for me).
Step one confirm which you are using GlassFish on Apache or GlassFish on IIS.
Here is what worked for me. I have IIS redirect access to the directory that the files are in using web.config. There is a redirect on the directory and the files within:
<rule name="Protect files and directories from prying eyes" stopProcessing="true">
<match url="(myPDFDirectory)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="CustomResponse" statusCode="403" subStatusCode="0" statusReason="Forbidden" statusDescription="Access is forbidden." />
</rule>
Or you can redirect them to your custom user capture stuff.
In htaccess it would be something like this (I am not good at Apache so you'll have to get a confirmation).
RewriteRule ^/myPDFDirectory/(.*)$ http://website.com/signUp.cfm [R=301,L]
I may have to review the first of the two examples but you get the point.
Now on to the file delivery.
I have seen this done the header content method. But unfortunately there is something going on with the server and it cannot access the directory with the PDF files. So I was able to access the files via HTTP. With the rewrite rule in place there no access 'directly' to the directory of files for outside users navigating around, however, when I call the the PDF to download through a HREF it works. I am using the new HTML 5 version of HREF with the download parameter. It forces download
Download Your Expense Report
There are other ways to feed the user his or her files for download like the cfheader/cfcontent method but I don't have directory access set up properly and the servers are ones I don't admin so I had to come up with something unconventional :/
I hope this is helpful...
I followed Avery Martell's advice and looked outside the web root. I ended up setting up an NFS appliance to store the files and setup appropriate permissions. After some additional research, this is a common best practice, especially for my needs which is to store documents > 1MB. At that size the benefits of storing in a db start to diminish, and storing them in a directory within the web root is unnecessarily complicated. I hope this helps those with similar needs.

ASP pages in IIS using Localhost 401.3 Error do not have permission

I have just installed the IIS so I can view asp files in a browser but when I put the address in a browser as : http://localhost/index.asp I get an error.
The error shows this:
HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.
I really need to get this sorted out, I would highly appreciate any advice on this.
My issue was around the identity used in the app pool. I changed the site's Authentication to "Application pool identity" as well as giving the directory the appropriate permissions.
OK, working from memory here as I am not in front of a Windows machine.
If you right click on your webroot folder /inetpub/wwwroot/ or the website directory you are working on open properties and select security, I think it is, you will see the list of users with their permissions for that folder. There is a section to add new users where you can add the IIS_IUSRS account (search from the list of users if you need to) which will be the default user used when anonymous authentication is enabled. Give this account the relevant permissions (read, write, execute) ensuring you apply to file and subfolders. Refresh the website in IIS and you should hopefully be good to go.
I had one folder not working (extracted from a zip file which came from an email from some kind of MS Sharepointy thing. Or something). The files were all marked with Windows Explorer -> Right Click -> Properties -> Advanced -> Encrypt contents to secure data. Unticking cured it.
In my case I had created an application in IIS 7 on Windows 7 using "Add Application" on the Default Web Site. I had to add the "users" account from the local machine and that got rid of the permissions error.
I had this happen to me and what I needed to do was apparently add a web.config file. Doesn't matter that it was just a PHP site, and that "Everyone" had full control. Until there was a basic Web.config - NO DICE!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Execute, Script" />
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
Here, the set up process is explained in detail. You can follow the steps.
http://coldfusion-tip.blogspot.com/2013/10/you-do-not-have-permission-to-view-this.html

404 error with IIS 7.0

I have a text file that I am trying to browse to using the browser http://files.mydomain.com/test.txt and I get a:
HTTP Error 404.0 - Not found
I double checked and the text file does exist. When I add a test.htm file, I have no issues.
Can someone help? Something tells me it's security issue.
Have you checked the following:
Your DNS 'A' record for 'files' is pointing to the correct IP address
If your server is using a shared IP address across multiple sites have you configured a HTTP host header?
Is there a mime type set for the .txt extension?
Have you made any changes to the Handler Mappings for the site? e.g. mapped the .htm extension to say the ASP ISAPI filter and accidentally removed the StaticFile handler?
Can you serve other static content such as .jpg, .gif, .pdf etc?
Kev has covered most of the possible problems, but for reference there is another possibility.
Confirm that in Request Filtering you either
have .txt as an Allowed extension, or
have Allow unlisted file name extensions ticked in Edit Request Filtering Settings
The same effect can be achieved with the following web.config section:
<system.webServer>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".txt" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
Also make sure also that the website is started. I was getting 404 and then realized that the Default Website was stopped because another website (Sharepoint) was using port 80. Sometimes the obvious is what gets you.
Add the MIME-Typ by going to ...
features / Mime-type
right click,
add,
put in the file extension ".txt"
and the mime-type "text/plain"
ok
et voila
I know this is an old post, but this might still help somebody out. I ran into this problem with my Asp.Net Core application. In my case it turned out that static files are served from a subdirectory called 'wwwroot' by default. Creating that subdirectory and moving the file in their solved it for me:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/index?view=aspnetcore-2.2&tabs=windows#web-root

Resources