Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling request when using a location #70

Open
AlexandreRio opened this issue Mar 6, 2017 · 3 comments
Open

Handling request when using a location #70

AlexandreRio opened this issue Mar 6, 2017 · 3 comments

Comments

@AlexandreRio
Copy link
Contributor

Hi,

Correct me if I'm wrong but the callback method of the server is not called if the requested file does not exist and a location is specified?

I'm trying to implement a webserver having a Rest API . How can I use my callback function for request:path() matching /api/ and serving html files otherwise? (apart from rewriting the Handler processRequest function?)

@AlexandreRio AlexandreRio changed the title Handle request when using a location Handling request when using a location Mar 6, 2017
@AlexandreRio
Copy link
Contributor Author

I'm starting to think the issue is somewhere else, I can't get the 404 error when requesting a file. The process loop for a while and end up saying ERR_EMPTY_RESPONSE (using chromium).

I think you should use a proper logging method to debug this kind of issue.

@ghost
Copy link

ghost commented Jul 30, 2019

Hi... I found a error in pegasus/handler.luafile. The location is related from the place where pegasus is ran. If you set "/www/" it is translated into "./www/". If I made a script run and inside I start pegasus, if I call:
./run then the location will be ./www/
if I call from anywhere like...
/home/me/luaproject/run then location will be the CWD not a fixed place for my project.

@Tieske
Copy link
Contributor

Tieske commented Jan 15, 2023

@ghost the intent of the code is to run it from a working directory, I think this is quite common. So not a bug.

Since the original issue was resolved, this can be closed I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants