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

Add CORS to webserver. #147

Closed
bakon11 opened this issue Mar 18, 2023 · 3 comments · Fixed by #149
Closed

Add CORS to webserver. #147

bakon11 opened this issue Mar 18, 2023 · 3 comments · Fixed by #149

Comments

@bakon11
Copy link

bakon11 commented Mar 18, 2023

Hi,

I currently use the carp webserver server behind a nginx reverse proxy. Due to the fact that express doesn't do well without the CORs package even if specified in the nginx config. I have to add it myself everytime I do a fork sync to a new release.

I was wondering if you guys would be willing to add it, if I submitted a simple PR to include cors in the carp webserver server.

Below are two files where the change would happen, package.json to include cors and its types and in the index.ts to pull it in and have express recognize it.

https://github.com/onchainapps/carp/blob/7c21ca5810fae78bc61492022ff8717feac3fa18/webserver/server/package.json#L43
https://github.com/onchainapps/carp/blob/7c21ca5810fae78bc61492022ff8717feac3fa18/webserver/server/package.json#L47

https://github.com/onchainapps/carp/blob/7c21ca5810fae78bc61492022ff8717feac3fa18/webserver/server/app/index.ts#L11

Thank you.
Mike

@bakon11 bakon11 closed this as completed Mar 19, 2023
@bakon11 bakon11 reopened this Mar 19, 2023
@GrzegorzDrozda
Copy link
Contributor

Hi @bakon11
Thank you for your inquiry. On first glance all looks good but let me talk to other team members and product owner.

Best Regards
Greg

@GrzegorzDrozda
Copy link
Contributor

Hi @bakon11
I created docker image with your code: https://github.com/dcSpark/carp/tree/add-cors When I ran doesn't work properly - server doesn`t respond to requests and looks like connection is hanging. How you are configuring CORS settings with this module?

@GrzegorzDrozda
Copy link
Contributor

Ok I found issue - should be app.use(cors()); instead of app.use(cors);

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

Successfully merging a pull request may close this issue.

2 participants