# When i want load google.com inside iframe i have problem : CORS protection

**URL:** <https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873>\
**Category:** Testing\
**Created:** [April 26, 2018, 2:20pm UTC](https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873 "2018-04-26T14:20:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmros](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/rmros/32/346_2.png) [@rmros](https://forums.bitovi.com/u/rmros)\
**Post date:** [April 26, 2018, 2:20pm UTC](https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873/1 "2018-04-26T14:20:51Z")

</div>

i want load [google.com](http://google.com) in iframe , and start funcunit test on that  
but i have errors !  
we have **CORS protection** , so i created reverse proxy with docker and nginx , and i set some header proxy  
but also i have problem

1)i run nginx inside docker

2)then i config nginx.conf

 ![2](https://canada1.discourse-cdn.com/flex035/uploads/donejs/original/1X/e11d547f4558c7487d5cf299f22b2955f4e688ff.jpg)

3)and i run google reverse proxy successfully

1. i went to intellij idea and changed iframe via my google proxy server ip and port

2. and then i commented funcunit tests else just for one test  

6)and finally i launched run test

 ![6](https://canada1.discourse-cdn.com/flex035/uploads/donejs/original/1X/0007de738b1aff3d0f048900f9cf23e4a633da5f.jpg)

i use nginx inside docker (my reverse proxy) :

unzip this file [https://files.gitter.im/bitovi/funcunit/8wQX/nginx-google-docker.rar](https://files.gitter.im/bitovi/funcunit/8wQX/nginx-google-docker.rar)

1. and inside the folder
2. enter these instruction 🙂
3. docker build -t nginx-google-docker-image-v1 .  
after image build then need to run with step 4)  
4)docker run --restart always -d -p 8001:8001/tcp -p 8081:8081/tcp -p 8086:8086/tcp -p 8886:8886/tcp --name nginx-google-docker nginx-google-docker-image-v1

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [April 26, 2018, 2:27pm UTC](https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873/2 "2018-04-26T14:27:01Z")

</div>

The problem here is that the hosted HTML and JS files are not the same\_\_domain\_\_ as where google is proxied.

I’m not sure how to do this with nginx, but it’s typically possible to mount the proxy under one folder and static assets under another.

For example, the proxy could be under `localhost:63342/proxy` and all the HTML and static assets under `localhost:63342/static`.

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [April 26, 2018, 2:36pm UTC](https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873/3 "2018-04-26T14:36:44Z")

</div>

Here’s some docs on how to setup a reverse proxy mounted under a particular path: [https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/)

```auto
location /some/path/ {
    proxy_pass http://www.example.com/link/;
}

```

---

<div class="post-metadata">

**Author:** ![rmros](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/rmros/32/346_2.png) [@rmros](https://forums.bitovi.com/u/rmros)\
**Post date:** [April 26, 2018, 3:03pm UTC](https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873/4 "2018-04-26T15:03:40Z")

</div>

yea we need configur multiple applications on same port usin based on request urls

---

<div class="post-metadata">

**Author:** ![rmros](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/rmros/32/346_2.png) [@rmros](https://forums.bitovi.com/u/rmros)\
**Post date:** [April 28, 2018, 6:28am UTC](https://forums.bitovi.com/t/when-i-want-load-google-com-inside-iframe-i-have-problem-cors-protection/873/5 "2018-04-28T06:28:46Z")

</div>

justin i solved CORS protection ,  
but there is another issue.  
see this link : [http://94.130.243.110/](http://94.130.243.110/)  
site load inside iframe  
but test commands doesn’t work  
[enter] not worked

F.speed = 500;

module(‘todomvc’);

test(‘basic todo functionality’, function() {  
var newTodo = F(’#lst-ib’, 0);  
newTodo.type(‘ematec [enter]’);  
newTodo.type(‘is [enter]’);  
newTodo.type(‘awesome! [enter]’);

});
