|
| 1 | +### Flask Options App |
| 2 | + |
| 3 | +This is a simple Flask application that demonstrates how to handle HTTP OPTIONS requests. |
| 4 | +It is designed to be run inside a Docker container and can be used for testing purposes. |
| 5 | +The app is configured to run on port 5000 inside the container and can be accessed on port 8081 on your localhost. |
| 6 | + |
| 7 | +- [Flask Options App](#flask-options-app) |
| 8 | +- [Testing the App](#testing-the-app) |
| 9 | +- [Accessing the App](#accessing-the-app) |
| 10 | +- [Stopping the App](#stopping-the-app) |
| 11 | +- [Testing HTTP OPTIONS Requests](#testing-http-options-requests) |
| 12 | + |
| 13 | +### Testing the App |
| 14 | + |
| 15 | +Navigate to the flask-options-app directory and execute the following commands: |
| 16 | + |
| 17 | +```bash |
| 18 | +docker build -t flask-options-app . |
| 19 | +docker run --rm -it -p 8081:5000 flask-options-app |
| 20 | + |
| 21 | +# If you want to run a shell inside the container for debugging: |
| 22 | +docker run -it -p 8081:5000 --entrypoint /bin/sh flask-options-app |
| 23 | + |
| 24 | +# If you want to run the app in the background: |
| 25 | +docker run -d -p 8081:5000 flask-options-app |
| 26 | +``` |
| 27 | + |
| 28 | +This will build the Docker image and run the container, mapping port 5000 inside the container to port 8081 on your localhost. |
| 29 | + |
| 30 | +### Accessing the App |
| 31 | + |
| 32 | +Once the container is running, you can access the Flask app by navigating to [`http://localhost:8081/api/test`](http://localhost:8081/api/test) in your web browser. |
| 33 | +You should see the Flask app running and be able to interact with it. |
| 34 | + |
| 35 | +### Stopping the App |
| 36 | + |
| 37 | +To stop the app, you can either stop the container from your terminal or use `docker-compose down` if you are using Docker Compose. |
| 38 | + |
| 39 | +### Testing HTTP OPTIONS Requests |
| 40 | + |
| 41 | +You can test the app by sending a GET request to the `/api/test` endpoint. You can use tools like `curl`, Postman, or your web browser to do this. |
| 42 | + |
| 43 | +```bash |
| 44 | +curl -X GET http://localhost:8081/api/test \ |
| 45 | + -x http://127.0.0.1:9090 \ |
| 46 | + -k -v |
| 47 | +``` |
| 48 | + |
| 49 | +```bash |
| 50 | +curl -X OPTIONS http://localhost:8081/api/test \ |
| 51 | + -x http://127.0.0.1:9090 \ |
| 52 | + -k -v |
| 53 | +``` |
| 54 | + |
| 55 | +To find the traffic in Caido, you can use the following HTTQL query : |
| 56 | + |
| 57 | +```sql |
| 58 | +request.url == "http://localhost:8081/api/test" |
| 59 | +``` |
| 60 | + |
| 61 | +Or: |
| 62 | + |
| 63 | +```sql |
| 64 | +request.url == "http://localhost:8081/api/test" and request.method == "OPTIONS" |
| 65 | +``` |
| 66 | + |
| 67 | +Or: |
| 68 | + |
| 69 | +```sql |
| 70 | +request.url.path == "/api/test" |
| 71 | +``` |
0 commit comments