Welcome! Log In Create A New Profile

Advanced

curl 301 moved permanently if I don't use slash at the end of the url

March 28, 2017 12:56PM
Hi,

I need to list the content of some directories with curl without to use a '/' at the end of the url.

If I do not use the slash then I receive the message below, otherwise the content is showed. I tried many rewrite rules without success.

[user@localhost ~]$ curl http://mydomain.example.com/data/foo

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>


[user@localhost ~]$ curl http://mydomain.example.com/data/foo/

<html>
<head><title>Index of /data/foo/</title></head>
<body bgcolor="white">
<h1>Index of /data/foo/</h1><hr><pre><a href="../">../</a>
<a href="57581/">57581/</a> 12-Jul-2016 01:56 -
<a href="57582/">57582/</a> 13-Jul-2016 01:55 -
<a href="57583/">57583/</a> 14-Jul-2016 00:34 -
</pre><hr></body>
</html>


This is my vhost configuration:

server {
listen 80;
server_name mydomain.example.com;
access_log /var/log/nginx/mydomain.example.com-access.log;
error_log /var/log/nginx/mydomain.example.com-error.log error;

location /data/foo {
alias /data/foo;
autoindex on;
}

location /data/bit {
alias /data/bit;
autoindex on;
}


Thanks.
Subject Author Posted

curl 301 moved permanently if I don't use slash at the end of the url

c4rl March 28, 2017 12:56PM

Re: curl 301 moved permanently if I don't use slash at the end of the url

Francis Daly April 03, 2017 11:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready