base URL is not detected correctly behind gateway (docker)
davinwang opened this issue · 2 comments
Hi,
I'm on springfox 2.9.2.
Firstly, I'm using following commands to start it on server xx.xx.xx.xx .
sudo docker run -d -p 28080:8080 swagger-image
Swagger-ui documents can be accessed via http://xx.xx.xx.xx:28080/swagger-ui.html directly. And the base URL is detected automatically as http://xx.xx.xx.xx:28080/.
Then, I put a gateway kong before the springfox on server yy.yy.yy.yy
sudo docker run -d -p 31000:8000 kong
Swagger-ui documents can be accessed via http://yy.yy.yy.yy:31000/swagger-ui.html. The apidocs is detected as http://yy.yy.yy.yy:31000/v2/api-docs correctly. However, the base URL is NOT SAME PORT as api-docs, it is http://yy.yy.yy.yy:8000.
I tried to proxy the request to mockbin.org for analysis, but I didn't find any http header like X-Forward containing 8000. And I also tried to change 8000 to 9000 and the base URL will move to 9000.
Is there a solution to this? Or how can I set the base URL on the fly instead of auto detect? Thanks~
move to springfox/springfox