I currently have a go webserver setup on localhost:1234 that has a endpoint of /static/sample2.docx which downloads sample2.docx in my downloads directory.
Golang code:
s := http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))
r.PathPrefix("/static/").Handler(s)
This refers to a folder called static and makes it into a static file server. Any file within it can be served with a localhost:1234/static/* (can be index.html, or in my case sample2.docx). It is successful when it comes to serving my .docx file once I click on it, so I would assume that it would be successful when it comes to responding to the API. I’m either thinking there is an issue with my header (though I’m not yet sure what that would look like)
Hello @humamdev,
Please use the domain name or IP address of the server instead of localhost in your tests. Docker container has its own localhost so the server cannot find a file at this URL http://localhost:1234/static/sample2.docx inside the container and this results in the error message.
127.0.0.1 equals localhost. It cannot be used when you use docker because docker container has its own localhost. You have to use the internal/external IP address or the domain name of the server.