Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hizla
waitlist
backend
Merge requests
!11
feat(conf): do not insert CORS middleware if ALLOWED_URL is "unset"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
feat(conf): do not insert CORS middleware if ALLOWED_URL is "unset"
cors-disable
into
main
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
feat(conf): do not insert CORS middleware if ALLOWED_URL is "unset"
Ophestra
requested to merge
cors-disable
into
main
9 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
This allows easy disablement of CORS for testing.
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
4170ffb5
1 commit,
9 months ago
1 file
+
8
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
app.go
+
8
−
4
View file @ 4170ffb5
Edit in single-file editor
Open in Web IDE
Show full file
@@ -17,10 +17,14 @@ func serve(sig chan os.Signal, db *leveldb.DB) error {
app
:=
fiber
.
New
()
// cors
app
.
Use
(
cors
.
New
(
cors
.
Config
{
AllowOrigins
:
[]
string
{
conf
[
allowedURL
]},
AllowHeaders
:
[]
string
{
"Origin"
,
"Content-Type"
,
"Accept"
},
}))
if
conf
[
allowedURL
]
!=
"unset"
{
app
.
Use
(
cors
.
New
(
cors
.
Config
{
AllowOrigins
:
[]
string
{
conf
[
allowedURL
]},
AllowHeaders
:
[]
string
{
"Origin"
,
"Content-Type"
,
"Accept"
},
}))
}
else
{
log
.
Println
(
"CORS disabled"
)
}
var
captcha
fiber
.
Handler
hCaptchaEnable
:=
conf
[
hCaptchaSiteKey
]
!=
"unset"
&&
conf
[
hCaptchaSecretKey
]
!=
"unset"
Loading