Can not open .txt file in the root

Hello,

I have an issue opening a txt verification in the root folder that I need for one external service. I need to be able to open the file via url like: domain.com/txt_verification.txt . My server is running via ngnix on port 3000 with this app.js code:

var frontity = require("./build/server").default;
var http = require("http");
var server = http.createServer(frontity);
server.listen(3000);

I tried adding the file in the build and static folder but no luck, still getting the 404. Anyone has solution for this?

Thanks!

@David, can you help here?

Hey @andreyagovski :wave:

I’m afraid that’s not currently possible to do with Frontity. At this moment, the only .txt file you can serve from the root of your Frontity server is robots.txt (see SEO - Frontity).

But, if you are using nginx as you said, and you can change the nginx configuration, I guess you can serve that file from nginx instead. You can see an example in this thread form Server Fault: Nginx - root versus alias, for serving single files? - Server Fault

By the way, once we release the Server Extensibility feature, Frontity developers will be able to extend their Frontity server and serve whatever files from Frontity directly, among other things. :slightly_smiling_face:

2 Likes

That will be great! I am not very experienced with nginx so I was looking on how to make the txt file available via frontity. I will take a look at the Nginx reference that you sent me. Thanks! Looking forward for this option in Frontity! :slight_smile:

1 Like

For anyone that will want to open txt files in the root of the project on server with nginx configuration here is what I did: In the nginx domain configuration file I have added before the “Location /” line this line:
location /text_file.txt { alias /var/www/website/static/text_file.txt; }

It worked like a charm! Thank you David again! :slight_smile:

1 Like