Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

502 gateway error when accessing AWS S3 Browser Policy #378

Closed
CaptainChemist opened this issue Nov 22, 2016 · 6 comments
Closed

502 gateway error when accessing AWS S3 Browser Policy #378

CaptainChemist opened this issue Nov 22, 2016 · 6 comments
Labels

Comments

@CaptainChemist
Copy link

CaptainChemist commented Nov 22, 2016

Hi everyone,
I am having an issue with the BrowserPolicy package in conjunction with Meteor-up that I hope someone can help me identify. When I add certain policies, it will work perfectly locally but it produces a 502 Bad Gateway error when I deploy to my website. This is an example s3 policy that gives me trouble:
BrowserPolicy.content.allowOriginForAll('*.amazonaws.com');
I am using meteor 1.4.2.3, node 7.1.0 and npm 4.0.2, but I was having this issue even with the older meteor version of 1.4.2. I am using the docker image abernix/meteord:base. I have also run into the 502 gateway error previously with the bootstrap cdn url but I was able to work around that by just hosting the font myself.

If it is helpful, I am using my s3 to load images (jpg, svg). Clearing my browser cache or using a different browser does not help.

I have read that this problem can be due to the header size being too large and that it can be fixed by changing proxy_buffer_size 8k; in the /var/lib/docker/aufs/mnt/CHECKEDID/opt/nginx/conf/nginx.conf file. Can anyone tell me how I can clone, modify, and publish a corrected abernix/meteord:base docker image? I am happy to make it publicly available for others, I just don't really understand how docker images work.

I checked a random svg file and the header size was 449 which is suspicious because when I compared the header size of a youtube embedded player which loads fine, that header size is 906 and there I used BrowserPolicy.content.allowOriginForAll('www.youtube.com'); with no problems. Is it possible that this gateway error is something other than the header size?

Thanks so much!

@zodern
Copy link
Owner

zodern commented Feb 11, 2017

@CaptainChemist did you find a solution?

@ivanthemeh
Copy link

ivanthemeh commented Feb 17, 2017

@zodern @CaptainChemist did you?

its because these settings need to be added in the docker containers nginx server block

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;

@Cu4rach4
Copy link

how we can solve this?, can we modified directly nginx, wish file needs to be modified?

Thnaks

@ivanthemeh
Copy link

I had to fork the github repo for jwilder/nginx-proxy then create an automated build on docker hub. Trigger the build and the go the the file at /src/modules/meteor/assets/templates/start.sh to reflect your docker hub repo. Don't forget to update your forked repo with config settings before triggering the automated build.

@zodern zodern added the Proxy label Jun 3, 2017
@zodern
Copy link
Owner

zodern commented Feb 8, 2018

Mup 1.4 allows customizing the nginx config.

@pisacode
Copy link

pisacode commented Nov 3, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants