I have set up my RPi 3 as Access Point to use a web-App, which is hostet by a flask server on the Pi. My HTTP-requests are generated by Swagger Codegen. The defined host is set to http://localhost:8080, which can't be changed due to development reasons. When I'm accessing now the web-App on the Pi I use the static IP-address of the Pi (in this case The web-App is shown but the HTTP-requests won't work because the basePath in my App is set to localhost.

Is there any possibility to solve this problem like pretending the HTTP requests comes from localhost IP.

  • It is not a problem in relation with RPI ... but first on the line 303 of the Swagger Codegen configuration file you have the possibility to add hosts filters : allowed = [".example.com", "localhost:9000"], see also the related link. – Ephemeral Oct 18 '19 at 11:33
  • 1
    Also, maybe try to put on this configuration for listening on all IP addr or maybe, put an entry in /etc/hosts with your own domain name and associate this with and put your server listening on this domain name. You cannot redirect the traffic because your client (another computer/ip adress on your LAN) should contact the server at and not localhost or (his own local network interface) , – Ephemeral Oct 18 '19 at 11:51
  • it is another network, the client cannot contact the 'remote server', for this reason your server must listen on the same network that where the client is connected. It can be also a problem with the Swagger Codegen application filters configuration or a bad configuration for the listen host for the server. In what file you have define the 8080 port ? – Ephemeral Oct 18 '19 at 11:52
  • Thanks for your help. When I'm changing the host address in swagger to the IP address of my Raspi everything works like a charme. So there is no possibility to keep the localhost address in swagger but get my setup working? – Stars_nStripes Oct 24 '19 at 6:44
  • Normally, you can use my first comment: listen to ALL IP addresses with 8080. (If you can put your raspberry IP, I think you can also put this address). BUT, your client can ONLY access the server on the same network. If the client tries to access (localhost), it contacts itself and will not join the server. Forget about localhost addr client side if you want to communicate from host to host ... But you can access the server using the host computer on which the server is started via if it also listens on this address – Ephemeral Oct 26 '19 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.