Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
api_proxy
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
api_proxy
Commits
a5795f56
Unverified
Commit
a5795f56
authored
5 years ago
by
Mateu Aguiló Bosch
Committed by
Mateu Aguiló Bosch
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3067286
by e0ipso: Cacheability issues
parent
5fe7b91e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Controller/Forwarder.php
+11
-5
11 additions, 5 deletions
src/Controller/Forwarder.php
with
11 additions
and
5 deletions
src/Controller/Forwarder.php
+
11
−
5
View file @
a5795f56
...
...
@@ -33,14 +33,20 @@ final class Forwarder extends ControllerBase {
public
function
forward
(
HttpApiInterface
$api_proxy
,
Request
$request
):
Response
{
// TODO: This belongs to the routing system.
$account
=
$this
->
currentUser
();
$cache_contexts
=
[
'url.query_args:'
.
Forwarder
::
QUERY_PARAM_URI
,
'headers:Origin'
,
'user.permissions'
,
];
$cacheability
=
(
new
CacheableMetadata
())
->
addCacheContexts
(
$cache_contexts
);
if
(
!
$account
->
hasPermission
(
key
(
$api_proxy
->
permissions
())))
{
$cacheability
=
(
new
CacheableMetadata
())
->
addCacheContexts
([
'user.permissions'
]);
throw
new
CacheableAccessDeniedHttpException
(
$cacheability
,
'The current user does not have access to this proxy'
);
throw
new
CacheableAccessDeniedHttpException
(
$cacheability
,
'The current user does not have access to this proxy'
);
}
$third_party_uri
=
$this
->
sanitizeUri
(
$request
->
query
->
get
(
static
::
QUERY_PARAM_URI
));
$cache_contexts
=
[
'url.query_args:'
.
static
::
QUERY_PARAM_URI
];
$cacheability
=
(
new
CacheableMetadata
())
->
addCacheContexts
(
$cache_contexts
);
if
(
empty
(
$third_party_uri
))
{
throw
new
CacheableBadRequestHttpException
(
$cacheability
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment