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

fix: allow all origins in devMode #3444

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

wesbillman
Copy link
Member

No description provided.

@wesbillman wesbillman requested a review from a team as a code owner November 20, 2024 22:28
This was referenced Nov 20, 2024
// Add controller address to allow origins for console requests.
// The console is run on `localhost` so we replace 127.0.0.1 with localhost.
if addr.Hostname() == "127.0.0.1" {
addr.Host = "localhost" + ":" + addr.Port()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we shouldn't run on "localhost" as it can trigger Mac security popups.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this one is interesting. I had to add this to solve a problem with running locally with my mac and it's working currently, but I def want to do whatever is correct here. Lemme try a few things here before merging, but this part of the code has been around for a while.


if devMode && len(s.CommonConfig.AllowHeaders) == 0 {
// Default to allowing all headers for console requests in local dev mode.
if devMode {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR but I just realised - what is "!devMode"? ftl dev/ftl serve are always dev mode...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha! I had the exact same question/thought when i was doing this. I think it's a flag that gets passed in and needs to get forwarded onto other code from within the cmd_serve. But it's only used/set by cmd_dev and it's always true.

@wesbillman wesbillman force-pushed the make-allow-origins-all-dev-default branch from 309be0e to 9ba1687 Compare November 20, 2024 23:05
@wesbillman wesbillman merged commit 81327f2 into main Nov 20, 2024
92 checks passed
@wesbillman wesbillman deleted the make-allow-origins-all-dev-default branch November 20, 2024 23:15
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 this pull request may close these issues.

2 participants