@@ -13,7 +13,11 @@ import fs from 'node:fs';
1313import path from 'node:path' ;
1414import TerserPlugin from 'terser-webpack-plugin' ;
1515import 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' ;
1721import FixStyleOnlyEntriesPlugin from 'webpack-remove-empty-scripts' ;
1822
1923import LastBuiltPlugin from './build-utils/last-built-plugin' ;
@@ -576,46 +580,59 @@ if (
576580
577581 // If we're running siloed servers we also need to proxy
578582 // those requests to the right server.
579- let controlSiloProxy = { } ;
583+ let controlSiloProxy : ProxyConfigArray = [ ] ;
580584 if ( CONTROL_SILO_PORT ) {
581585 // TODO(hybridcloud) We also need to use this URL pattern
582586 // list to select control/region when making API requests in non-proxied
583587 // environments (like production). We'll likely need a way to consolidate this
584588 // with the configuration api.Client uses.
585589 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+ ] ;
603612 }
604613
605614 appConfig . devServer = {
606615 ...appConfig . devServer ,
607616 static : {
608- ...( appConfig . devServer . static as object ) ,
617+ ...( appConfig . devServer . static as Static ) ,
609618 publicPath : '/_static/dist/sentry' ,
610619 } ,
611620 // syntax for matching is using https://www.npmjs.com/package/micromatch
612- proxy : {
621+ proxy : [
613622 ...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+ ] ,
619636 } ;
620637 appConfig . output ! . publicPath = '/_static/dist/sentry/' ;
621638 }
0 commit comments