@@ -13,7 +13,11 @@ import fs from 'node:fs';
13
13
import path from 'node:path' ;
14
14
import TerserPlugin from 'terser-webpack-plugin' ;
15
15
import webpack from 'webpack' ;
16
- import type { Configuration as DevServerConfig } from 'webpack-dev-server' ;
16
+ import type {
17
+ Configuration as DevServerConfig ,
18
+ ProxyConfigArray ,
19
+ Static ,
20
+ } from 'webpack-dev-server' ;
17
21
import FixStyleOnlyEntriesPlugin from 'webpack-remove-empty-scripts' ;
18
22
19
23
import LastBuiltPlugin from './build-utils/last-built-plugin' ;
@@ -576,46 +580,59 @@ if (
576
580
577
581
// If we're running siloed servers we also need to proxy
578
582
// those requests to the right server.
579
- let controlSiloProxy = { } ;
583
+ let controlSiloProxy : ProxyConfigArray = [ ] ;
580
584
if ( CONTROL_SILO_PORT ) {
581
585
// TODO(hybridcloud) We also need to use this URL pattern
582
586
// list to select control/region when making API requests in non-proxied
583
587
// environments (like production). We'll likely need a way to consolidate this
584
588
// with the configuration api.Client uses.
585
589
const controlSiloAddress = `http://127.0.0.1:${ CONTROL_SILO_PORT } ` ;
586
- controlSiloProxy = {
587
- '/auth/**' : controlSiloAddress ,
588
- '/account/**' : controlSiloAddress ,
589
- '/api/0/users/**' : controlSiloAddress ,
590
- '/api/0/api-tokens/**' : controlSiloAddress ,
591
- '/api/0/sentry-apps/**' : controlSiloAddress ,
592
- '/api/0/organizations/*/audit-logs/**' : controlSiloAddress ,
593
- '/api/0/organizations/*/broadcasts/**' : controlSiloAddress ,
594
- '/api/0/organizations/*/integrations/**' : controlSiloAddress ,
595
- '/api/0/organizations/*/config/integrations/**' : controlSiloAddress ,
596
- '/api/0/organizations/*/sentry-apps/**' : controlSiloAddress ,
597
- '/api/0/organizations/*/sentry-app-installations/**' : controlSiloAddress ,
598
- '/api/0/api-authorizations/**' : controlSiloAddress ,
599
- '/api/0/api-applications/**' : controlSiloAddress ,
600
- '/api/0/doc-integrations/**' : controlSiloAddress ,
601
- '/api/0/assistant/**' : controlSiloAddress ,
602
- } ;
590
+ controlSiloProxy = [
591
+ {
592
+ context : [
593
+ '/auth/**' ,
594
+ '/account/**' ,
595
+ '/api/0/users/**' ,
596
+ '/api/0/api-tokens/**' ,
597
+ '/api/0/sentry-apps/**' ,
598
+ '/api/0/organizations/*/audit-logs/**' ,
599
+ '/api/0/organizations/*/broadcasts/**' ,
600
+ '/api/0/organizations/*/integrations/**' ,
601
+ '/api/0/organizations/*/config/integrations/**' ,
602
+ '/api/0/organizations/*/sentry-apps/**' ,
603
+ '/api/0/organizations/*/sentry-app-installations/**' ,
604
+ '/api/0/api-authorizations/**' ,
605
+ '/api/0/api-applications/**' ,
606
+ '/api/0/doc-integrations/**' ,
607
+ '/api/0/assistant/**' ,
608
+ ] ,
609
+ target : controlSiloAddress ,
610
+ } ,
611
+ ] ;
603
612
}
604
613
605
614
appConfig . devServer = {
606
615
...appConfig . devServer ,
607
616
static : {
608
- ...( appConfig . devServer . static as object ) ,
617
+ ...( appConfig . devServer . static as Static ) ,
609
618
publicPath : '/_static/dist/sentry' ,
610
619
} ,
611
620
// syntax for matching is using https://www.npmjs.com/package/micromatch
612
- proxy : {
621
+ proxy : [
613
622
...controlSiloProxy ,
614
- '/api/store/**' : relayAddress ,
615
- '/api/{1..9}*({0..9})/**' : relayAddress ,
616
- '/api/0/relays/outcomes/' : relayAddress ,
617
- '!/_static/dist/sentry/**' : backendAddress ,
618
- } ,
623
+ {
624
+ context : [
625
+ '/api/store/**' ,
626
+ '/api/{1..9}*({0..9})/**' ,
627
+ '/api/0/relays/outcomes/**' ,
628
+ ] ,
629
+ target : relayAddress ,
630
+ } ,
631
+ {
632
+ context : [ '!/_static/dist/sentry/**' ] ,
633
+ target : backendAddress ,
634
+ } ,
635
+ ] ,
619
636
} ;
620
637
appConfig . output ! . publicPath = '/_static/dist/sentry/' ;
621
638
}
0 commit comments