wso2 / docker-apim

Docker and Docker Compose resources for WSO2 API Manager
Apache License 2.0
143 stars 215 forks source link

API Manager Store using Docker container IP #134

Open f0nZ opened 6 years ago

f0nZ commented 6 years ago

Description: While using docker in my machine, everything is ok, but I assume that's due to using 'localhost' ip. When I upload to a VPS, API Manager Store for some reason uses docker container ip instead my Azure machine IP. Takes a lot of time to load the page and most of it is broken because all images/api production and sandbox links all point to the docker container ip.

Edit: OK, while I was writing this I instantly fixed it...

If you run this project in your localhost machine, it's ok, but when you try to publish online you need to change a single line to fix any connectivity problem.

After API Manager deploys he creates this file (you need to docker exec to check this out): ..\wso2am-2.2.0\repository\deployment\jaggeryapps\store\site\conf\site.json

All you need to do is to change this line:

"whiteListedHostNames" : ["localhost"]

And change it considering your machine in the cloud is 53.42.13.23 or whatever:

"whiteListedHostNames" : ["localhost","53.42.13.23"]

If you had any broken image or url in API Manager Store, this will fix it, but still Production and Sandbox URLs will remain with docker container ip address. Will try to fix that too but you can just override it by swapping manually both ip's while making a call.

Valdanitooooo commented 5 years ago

:+1::+1::+1:

nasuc commented 5 years ago

Awesome @f0nZ , it makes a huge difference. Any findings on the broken links from API Console screen (from STORE)?

oscarvesga commented 4 years ago

@f0nZ great job, congrats

To change the IP in the console store replace the next lines in the file <APIM_HOME>/repository/conf/api-manager.xml

    <APIStore>
        <!--GroupingExtractor>org.wso2.carbon.apimgt.impl.DefaultGroupIDExtractorImpl</GroupingExtractor-->
        <!--This property is used to indicate how we do user name comparision for token generation https://wso2.org/jira/browse/APIMANAGER-2225-->
        <CompareCaseInsensitively>true</CompareCaseInsensitively>
        <DisplayURL>true</DisplayURL>
        <URL>https://localhost:${mgt.transport.https.port}/store</URL>

you can change localhost for you host ip