Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

access forbidden on url containing colon symbol, ":", on apache windows

i can't open url with ":" inside url in my localhost for example, i can't open http://bolehnonton.dev/Halo-4:-Forward-Unto-Dawn (this is in my localhost). the result page in my browser is

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403 bolehnonton.dev
Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12

but i can open similiar url with my hosting, http://bolehnonton.com/Halo-4:-Forward-Unto-Dawn

although htaccess file of both is similiar.

here my vhost configure on my xampp

<VirtualHost *:80>
 ServerAdmin [email protected]
   DocumentRoot "C:/xampp/htdocs/bolehnonton.com"
   ServerName bolehnonton.dev 
   <Directory C:/xampp/htdocs/bolehnonton.com>
    Allow from all
     Require all granted
        Options Indexes
  </Directory>
</VirtualHost>
like image 319
pallasmeong Avatar asked Nov 04 '15 08:11

pallasmeong


People also ask

Is colon character allowed in URL?

Colon IS an invalid character in URL unless it is used for its purpose (for eg http://). "...Only alphanumerics [0-9a-zA-Z], the special characters "$-_. +! *'()," [not including the quotes - ed], and reserved characters used for their reserved purposes may be used unencoded within a URL."

What Colon mean in URL?

It's just a separator. It doesn't 'mean' or 'specify' anything. In your own example it is also used to separate the scheme from the hostname.


1 Answers

It is an Apache bug on Windows declared as WONTFIX in 2009. I fixed it in libapr-1.dll, function test_safe_name in srclib\apr\file_io\win32\filestat.c to return ERROR_FILE_NOT_FOUND for names with colon.

if (*name == '?' || *name == '*')
    return APR_EPATHWILD;
else
    return (*name == ':') ? APR_FROM_OS_ERROR(ERROR_FILE_NOT_FOUND) : APR_EBADPATH; // was: APR_EBADPATH;

I could avoid recompiling Apache and patched the binary.

like image 70
Jeremitu Avatar answered Oct 05 '22 00:10

Jeremitu