How to let NGINX load netlify content via reverse proxy

I have setup reverse proxy loading of index.html file in my NGINX to display content under different domain. This works fine but then all assets are supposed to be loaded directly from netlify from other domain but from some unknown reason not getting any response when calling them.
When I call assets from same domain(browser/postman) it works.
I also added file _headers with Access-Control-Allow-Origin: * but it doesn’t help.

Not working headers:

1. :authority:

assets.webutton.com

2. :method:

GET

3. :path:

/runtime-es2015.3db1414f4063df17d69d.js

4. :scheme:

https

5. accept:

6./*

7. accept-encoding:

gzip, deflate, br

8. accept-language:

en-US,en;q=0.9,de;q=0.8,sk;q=0.7,cs;q=0.6

9. cache-control:

no-cache

10. origin:

https://cbc.im

11. pragma:

no-cache

12. referer:

https://cbc.im/

13. sec-fetch-dest:

script

14. sec-fetch-mode:

cors

15. sec-fetch-site:

cross-site

16. user-agent:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

Working headers:

1. :authority:

assets.webutton.com

2. :method:

GET

3. :path:

/runtime-es2015.3db1414f4063df17d69d.js

4. :scheme:

https

5. accept:

6./*

7. accept-encoding:

gzip, deflate, br

8. accept-language:

en-US,en;q=0.9,de;q=0.8,sk;q=0.7,cs;q=0.6

9. cache-control:

no-cache

10. cookie:

btnimSCF=1; webutton_HP=7e0a39d45f9195ca4fda8caae88557153d0574271c2c3cb4fe37cd0698e6d614

11. origin:

https://assets.webutton.com

12. pragma:

no-cache

13. referer:

https://assets.webutton.com/de/e/mfox/1

14. sec-fetch-dest:

script

15. sec-fetch-mode:

cors

16. sec-fetch-site:

same-origin

17. user-agent:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

Hi, @jokuja. Our support team can troubleshoot Netlify specific issues but we are not able to troubleshoot your NGINX reverse proxy.

Someone else may be able to answer you questions here but our support team has a specific scope of support.

Now, I can troubleshoot specific HTTP requests made to our service because that is Netlify specific. I can tell you what the requests look like from our side and this might help you to find the root cause.

If you have the x-nf-request-id response header for the HTTP response or responses that our CDN returns, then I can find the HTTP request we received for it.

There more information about this header here:

If that header isn’t available for any reason, please send the information it replaces (or as many of these details as possible). Those details are:

  • the complete URL requested
  • the IP address for the system making the request
  • the IP address for the CDN node that responded
  • the day of the request
  • the time of the request
  • the timezone the time is in

If there are questions about any of this, please let us know.

Thanks a lot for your response.
Example of response from Netlify which failed:

x-nf-request-id:
77573eb6-0f85-4574-9e93-550190b786ae-14296093

Hi, @jokuja. That x-nf-request-id shows a 200 response and the CDN node successfully sent the requested file.

There was no failure at Netlify for that request. What sort of issue do you see with the proxied request?

Browser does not display the content neither status of response properly:

To me it seems like issue with CORS setting.
How can I make sure that my setup from _headers is considered?

/*
Access-Control-Allow-Origin: *

Hi, @jokuja, then if it isn’t working that issue is being caused by your proxy not Netlify.

I cannot troubleshoot that system (the reverse proxy). You are responsible for the request from your reverse proxy to the browser. We sent it correctly to your proxy and it failed after that. Therefore this will be up to you to troubleshoot.

Again, troubleshooting a third-party system is not something our support team can (do unless you have a paid contract which includes that level of support). Note, paid support contract pricing begins at $1000 a month. If you are interested in this level of support, please let us know and our sales team will contact you.

Again, someone else here on this community site may be able to assist you but our default support scope, even for Enterprise accounts, does not include support or troubleshooting of any third-party systems like your reverse proxy. If there are questions about why we don’t support troubleshooting a third-party system, please let us know and we will be happy to explain why that is.

Others reading this, please do feel free to assist.

Thanks for the response.

I debugged it and I see that issue is same also on requests which are not proxied.

I just need to allow cross origin policy.

I tried approach as written in this post using _headers file but I do not see it changed:
Access-Control-Allow-Origin Policy

You can see the issue here: https://cbc.im/de/e/mfox/1

resolved, my problem was file _headers missing in the build folder