Various webservers allow the configuration of welcome files, so that when an URL points to a directory and the directory contains an index.html file, that file is being served.
Can I configure polymer serve so that it also serves index.html files when a directory URL is requested?
Internally, polymer-cli is based on polyserve, which is based on Express, having middleware abilities that might help. Do I really have to go so deep?
Unfortunatly polymer-cli only passes on to express a set of pre defined arguments. see: https://github.com/Polymer/polymer-cli/blob/c5f8db4c3db39fdb90a089739a5c48961210417a/src/commands/serve.ts#L63
But it looks like the ability to add middleware is in the works https://github.com/Polymer/polyserve/issues/250
Related
I'm following the symfony create your own mvc tutorial and I'm at a loss as to how to configure my apache server to point to the web directory.
Following the tutorial. My file structure has pages in the src folder, composer in the vendor folder and my front.php in the web folder with the associated routes. If I go to web/front.php all works fine.
How do I configure the .htaccess file?
Generally it is recommended not to use dynamic configuration files (".htaccess"), but to place rewriting rules inside the host configuration itself (performance and maintainability reasons). You will find tons of examples for such internal rewritings here on SO, your best starting point to read into that however certainly is the official documentation. It comes with great examples: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
This is a simple example that should point you into the right direction:
RewriteEngine on
RewriteRule ^/?projectname/(.*)/?$ /web/front.php?variable=$1 [L]
That will take care to internally rewrite the request so that you can access the variable value as $_GET['variable'].
The example uses a pattern that will work likewise in dynamic configuration files (".htaccess") and in the real http servers host configuration. If you really want to use dynamic files, then you also need to enable their interpretation by means of the AllowOverride directive. Again take a look at the official documentation for that: https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
I need to setup intern to test ajax calls from a different server. I set everything up sort of following the official wiki in this address
https://github.com/theintern/intern/wiki/Using-Intern-to-unit-test-Ajax-calls
My config file has proxyUrl set to http://localhost:8080/sub
and http://localhost:8080/sub is setup as a reverse proxy to inter-runner in http://localhost:9000
When I run ./node_modules/.bin/intern-runner -config=tests/config from the tests root folder, the browser opens up and is able to request several files, until it tries to request the config file. That's when it receives a 404, because it requests the wrong address - http://localhost:8080/tests/config.js - without the sub folder.
I'm wondering if I'm missing something inside the config file, or if intern is not able to use proxies with subfolders. I tried to set the baseUrl parameter, but it had no effect.
Any ideas?
Update:
It seems that sometimes intern-runner uses the path provided in the config param, and sometimes it uses the one in the proxyUrl parameter inside the config file. As a workaround, what I did was to place the config file and the tests on 2 folders (actually I made a symbolic link). The first on tests/ and the second on sub/tests/ and ran it using ./node_modules/.bin/intern-runner -config=sub/tests/config.
It works, but it's kind of stupid and I really wished there was a better way to do it.
This is indeed a limitation/bug of intern. It assumes that the proxy sits at the root of the absolute domain name, i.e. that it has a pathname of /.
An issue has been created on intern's github repository here and the corresponding pull request that fixes the problem is here. Hopefully this gets merged into the upcoming 2.1 release of intern.
How do I customize the list that web server does in absence of index.* file in the web root or its child directory, if we do not put any index files in the web root directory and the directory has the read permission?
you can set the page to show for a directory url with the index directive, it doesn't need to point to something called index.*, might just as well be whatever.html. See http://nginx.org/en/docs/http/ngx_http_index_module.html#index for details
or you can set autoindex on to give a generated file/directory listing, you can use the autoindex_exact_size and autoindex_localtime to further customize that listing. See http://nginx.org/en/docs/http/ngx_http_autoindex_module.html for details
3th option, if your nginx is compiled with it, is the random_index, see http://nginx.org/en/docs/http/ngx_http_random_index_module.html for details.
NOTE: to find out if your nginx is compiled with the needed --with-http_random_index_module option use the command nginx -V
Well, it depends on what webserver you are using.
In case of Apache, direcory indexes handled by a module called mod_autoindex.
When you want to customize the directory listing, then you have to know that Apache need three 'view' files:
The Header — by default automatically generated by Apache The
Directory Listing — necessarily generated by Apache
The Footer — referred to as the “Readme” file
The Header and Footer parts are basically written in plain HTML. The directory listing is generated by Apache but you can apply CSS on it..
The whole thing is a rather long story, so what I can suggest is a well written article with the details about this 'directory listing customisation':
Better Default Directory Views with .htaccess
I am developing a Java application and I have to integrate a Perl application's code in it. The service has been provisioned on a CGI server.
When I am copying Perl files to the server location, index files are supposed to be automatically invoked. But when I am testing that URL, it is showing me the directory structure and not the default index page.
You chaneg the defaut directory listing function of Apache using the DirectoryIndex directive as described in the Apache Documentation
So if you want myprog.pl to run, instead of seeing a directory index, then you need a directive similar to:
DirectoryIndex myprog.pl
Your exact directive will be similar, but may differ depending on file paths.
Today I discovered that my fresh installation of Apache HTTP Server is able to serve files from my C:\uploads\ directory.
I have two folders in C:\uploads:
C:\uploads\templates
C:\uploads\sites
Both folders contain testimage.jpg.
I found that Apache will serve the files from the templates folder if I request:
http://localhost/templates/testimage.jpg
However, http://localhost/sites/testimage.jpg 404's!
OMG - firstly, why does Apache serve the templates folder in the first place? Is it special?
Secondly, by what arbitrary set of rules does apache disallow access to other folders such the sites?
I'm so confused. Perhaps I've taken a wrong turn somewhere during the installation.
Did you look through your httpd.conf file to see what rules are in place for what is being served? Alternatively, are there .htaccess files that may be changing what is being served? You might have templates exposed in one or the other, but not sites... that's the first thing that comes to mind.
I would suggest going through these configuration files with a fine toothed comb to see what may cause the behavior you see.