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

Disable CORS for local deployments #428

Open
priamai opened this issue Sep 5, 2023 · 5 comments
Open

Disable CORS for local deployments #428

priamai opened this issue Sep 5, 2023 · 5 comments

Comments

@priamai
Copy link

priamai commented Sep 5, 2023

Hello,
we need to find a way to disable CORS for local deployments otherwise it's impossible to use.

image

@v-shaal
Copy link

v-shaal commented Sep 5, 2023

➕➕

@dayesouza
Copy link
Contributor

Hi guys! I guess it's not CORS, but a backend problem. Can you send me the call Response on the network tab, please?

@priamai
Copy link
Author

priamai commented Sep 5, 2023

Hmmm it is weird, but I do believe is a simple CORS issue:

image

image

There is no response from server because is blocked.

image

But from the docker logs:

showwhy-frontend-1        | @showwhy/webapp:start: Entrypoint main 24.3 MiB (20.5 MiB) = main.ff838458f89b87c18d99.js 24.3 MiB main.04dc6812f929d7051131.hot-update.js 360 bytes 2 auxiliary assets
showwhy-frontend-1        | @showwhy/webapp:start: cached modules 21.4 MiB [cached] 8017 modules
showwhy-frontend-1        | @showwhy/webapp:start: runtime modules 34 KiB 18 modules
showwhy-frontend-1        | @showwhy/webapp:start: webpack 5.75.0 compiled successfully in 2222 ms
showwhy-backend_api-1     | INFO:     192.168.2.23:43620 - "OPTIONS /api/discover/pc HTTP/1.1" 400 Bad Request

The error is a 400 which matches the browser info:


Request URL:
http://kausal.ai:8081/api/discover/pc
Request Method:
OPTIONS
Status Code:
400 Bad Request
Remote Address:
192.168.2.25:8081
Referrer Policy:
strict-origin-when-cross-origin

@dayesouza
Copy link
Contributor

Thanks for the images! I'm trying to build it here again because up to this day I couldn't get the same error, I'll check here

@priamai
Copy link
Author

priamai commented Sep 5, 2023

Thanks a lot so this is the command I used:

yarn install
yarn build # or yarn force_build
yarn start

This is the only file I modified, the package.json I changed the host to my local domain:

{
	"name": "showwhy",
	"private": true,
	"version": "2.0.0",
	"description": "MSR Resilience Causal Platform",
	"main": "index.js",
	"repository": "[email protected]:v3/msresearch/Resilience/causal-platform",
	"author": "Chris Trevino <[email protected]>",
	"license": "UNLICENSED",
	"scripts": {
		"_acceptance_test_packages": "turbo run acceptance_test",
		"_fix_packages": "turbo run fix",
		"_check_packages": "turbo run check",
		"_ci_packages": "turbo run ci",
		"rome_fix": "rome check . --apply-suggested",
		"rome_ci": "rome ci .",
		"clean": "turbo run clean --parallel",
		"assets": "turbo run assets",
		"build": "turbo run build",
		"force_build": "turbo run build --force",
		"archive": "turbo run archive",
		"poetry_install": "turbo run poetry_install --parallel",
		"check": "run-s _check_packages rome_ci",
		"fix": "run-s _fix_packages rome_fix format",
		"format": "rome format . --write",
		"test": "turbo run test",
		"ci": "run-s _ci_packages rome_ci",
		"acceptance_test": "start-server-and-test start http://kausal.ai:3000 _acceptance_test_packages",
		"start_webapps": "echo 'use the start_frontend command instead' && exit 1'",
		"start_frontend": "cross-env EXPOSURE_API_URL=http://kausal.ai:8081/api/exposure DISCOVER_API_URL=http://kausal.ai:8081/api/discover EVENTS_API_URL=http://kausal.ai:8081/api/events turbo run start --parallel",
		"start_frontend_raw": "turbo run start --parallel",
		"start": "docker compose --profile all up",
		"start_fresh": "docker compose --profile all build && docker compose --profile all up",
		"start_backend": "docker compose --profile backend up",
		"start_backend_fresh": "docker compose --profile backend build && docker compose --profile backend up",
		"deploy": "turbo run deploy",
		"is_clean": "git checkout .npmrc && git diff-index HEAD --quiet || (git status && error_not_clean)",
		"prettify": "essex prettify",
		"stories": "yarn start:storybook",
		"update_sdks": "yarn dlx @yarnpkg/sdks vscode"
	},
	"devDependencies": {
		"@essex/eslint-config": "^20.5.1",
		"@essex/eslint-plugin": "^20.5.1",
		"@essex/jest-config": "^21.0.20",
		"@essex/prettier-config": "^18.0.7",
		"@essex/scripts": "^24.0.2",
		"cross-env": "^7.0.3",
		"eslint": "^8.32.0",
		"jest": "^29.4.0",
		"npm-run-all": "^4.1.5",
		"prettier": "^2.8.3",
		"rome": "^11.0.0",
		"start-server-and-test": "^1.15.3",
		"turbo": "1.6.3",
		"typescript": "^4.9.4"
	},
	"workspaces": [
		"javascript/*"
	],
	"packageManager": "[email protected]"
}

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

No branches or pull requests

3 participants