Why can I only use SSI with relative path? - cgi

I just read a little tutorial on SSI and managed to show what I wantedbut I'd like to use an absolute path to point at this file, but for some reason I can only do it with a relative path. Am I doing something wrong?
<!--#include virtual="/menubar/bar.html" -->
Works
But when I use:
<!--#include virtual="http://chusmix.com/menubar/bar.html" -->
I get this error: [an error occurred while processing this directive]
Thanks!

Typically SSIs must refer to local filesystem paths. What you are trying to use isn't an absolute filesystem path - it's an HTTP URL.

Related

Securing GitLab Pages with Let's Encrypt gets 404

I am following this tutorial https://about.gitlab.com/2016/04/11/tutorial-securing-your-gitlab-pages-with-tls-and-letsencrypt/
Next step instructions are:
Make sure your web server displays the following content at
http://YOURDOMAIN.org/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM
before continuing:
5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM.ewlbSYgvIxVOqiP1lD2zeDKWBGEZMRfO_4kJyLRP_4U
#
# output omitted
#
Press ENTER to continue
According to the tutorial, it's using Jekyll, but I don't use a static html generator like jekyll. The files are all static html. I created the exact path under root folder: /.well-known/acme-challenge/PukY0bbiH3nRfciQ4IzwTDIXFn4G5sZ5I-LkMz3-KHE.html
But after the piplines jobs are done, I am still getting 404. What's the problem here?
I had problem same yesterday and I found the solution, I hope it is not too late to share with you. According to this tutorial here, the "well-known" folder should be under the "public" folder.
And the letsencrypt need to access a .html file in the following path using the browser.
http://YOURDOMAIN.org/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM
To do this, you must create the "index.html" file in the path below inside your gitlab repository.
public/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM/index.html
In the "index.html" file you should put only the following sentence:
5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM.ewlbSYgvIxVOqiP1lD2zeDKWBGEZMRfO_4kJyLRP_4U
important: do not put any html tag, just the plain text above.
Then just continue following the tutorial. Good luck.

How to default HTTP request to servername followed by path in JMeter

I'm new to JMeter and am having trouble figuring out how to get my default URL to be what I want it to be. Right now, I've added an HTTP Request Defaultsconfig element to my test plan. In the Web Server box I have a url of the following format:
testproject.company.com
What I actually want the default URL to be is
testproject.company.com/test
The first thing I tried was setting the Server Name or IP to testproject.company.com/test, but this gave me an error
java.net.UnknownHostException: testproject.company.com/test
Next, I set Server Name or IP back to testproject.company.com and filled in the Path box in the HTTP Request section with
/test
This does not cause any errors, but all of my tests fail because it is simply using testproject.company.com as the default URL.
I am also using a Project Files config, and within the Configure the CSV Data Source section, in the Filename box, have the path to a .csv file. The .csv file has the following contents:
testproject.company.com/test/,username#testproject.train,10,true,WIN
What's preventing JMeter from adding /test to the default URL?
I believe the issue is due to a misunderstanding of the Path field under the HTTP Request Defaults section. It appears that the path in that section will only be used for tests where a path is not defined. So instead of adding the path from the test to the default path, it simply replaces it. Because of this, you have to manually add the path to each test that specifies a path.
If anyone knows of a better way to do this, let me know!
Use userdefined variables
Declare the "/test" as PATHVARIABLE in a user defined variable.
In each request append the variable to the path
${PATHVARIABLE}/yourUrl
Add "HTTP Sampler" under Thread group. In HTTP Request Defaults define Server IP as testproject.company.com and in HTTP Sampler define "/test" as Path.Leave the Server Name or IP field blank.
Thanks
The first thing I tried was setting the Server Name or IP to
testproject.company.com/test, but this gave me an error
java.net.UnknownHostException: testproject.company.com/test
It appears that this error is given depending on which "implementation" you are using for the HTTP Request sampler.
Setting the implementation to anything other than 'Java' (e.g. HttpClient4) solved this problem for me.

Apache httpd mod_include - handle include of 400+ responses with blank

I want to you Apache 2.2 httpd to SSI include URLs using
<!--#include virtual="/content/foo.html" -->
My problem is if, the SSI included page doesnt exist on my App server, it responds with a 404 response and a default error page HTML, which is then stitched into my page via the include.
For failing (4xx,5xx) SSI includes I simply want the SSI include to add the empty string to my page.
It doesn't appear Apache 2.2. supports the 'onerror' directive (which I think would solve this) - and i dont see any other options.
http://httpd.apache.org/docs/2.2/mod/mod_include.html
You could potentially add a rewrite to handle those portions of your application's URI space, but I'd advise against it. The approach being investigated seems to not fix the main problem: the concept of SSIs hinges on the files being included should be consistently available. If the included files are returning 4xx or 5xx class errors, the onus is on you to fix these errors.

Enable the use of SSI

Using HostGator, I can't seem to get SSI to work on my server. I'm using Dreamweaver to build the site and the everything works just fine in the preview. But when I actually upload the pages to my server, any elements that are includes files don't appear. Does anyone know how I can enable SSI on my web server?
Your last comment gave me the information I need. The issue is that the file is not in the same directory as the file you're trying to add the footer.inc file to. Try this code:
<!--#include virtual= "includes/footer.inc" -->
when using the file= parameter, the file you're including must be in the same directory. If the file you're including is not in the same directory, then you will have to use virtual. See this page for more information: SSI: The Include Command.
And here, from the source, is pretty much the rule of thumb: Use file= when the included file is within the same directory as the page that wants it. Use virtual= when it isn't.
EDIT: I think I got it now. Copy and paste the above code and it should work for you. Make sure you follow these guideline: after <!--, there is no space between the last - and #. Additionally, there is a space between the closing " and the first -. These rules must be adhered to. You can view more information here: Server Side Includes Not Working

method for getting correct system path on windows

I have made up a simple http server using libevent. The way the resource (folders in my case) are accessed is
http://serverAddress:port/path/to/resouce/
the path to resource is extracted using the decoded url . It works fine on Linux as request would be something like this
http://severAddress:port/home/vickey/folder
but on window$ request is
http://serverAddress:port/c:/users/vickey/folder
which results in decoded url as /c:/users/vickey/folder. Its manually possible to remove the leading slash to correct the problem. However since I m using and learning boost libraries in my code I was wondering if there was some implementation of this sort ? I tried using native() and relative_path(). Thanks.
Its definitely possible to do as you're asking, but I would suggest a different approach. How about creating a configuration property for the server which could be called RESOURCE_BASE_PATH. The resource path received in the URL would be appended to the RESOURCE_BASE_PATH to create the complete path.
This is pretty standard for FTP and HTTP servers and the like. On Windows, it could be set to "c:" and on Linux, left blank which would default to "/".
Also remember on Windows the slashes (\) are different than those on Unix (/).