Код: Выделить всё
const config: CapacitorConfig = {
appId: 'com.example.app',
appName: ' Gardian',
webDir: 'build',
server: {
url: 'http://192.168.246.108:8082',
cleartext: true
}
Я попытался установить разрешение на «http: // localhost», как это упоминает на официальной странице ионической, и не выполняет, что это не так. Может быть, мое понимание конечных точек и происхождения разрушено, и мне нужно еще немного объяснения по этой теме, но я попробовал со всем, что имело смысл, и я не знаю, что еще делать в данный момент. @Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf(csrf -> csrf.disable())
.cors(cors -> cors.configurationSource(corsConfigurationSource())) // CORS configuration
.authorizeHttpRequests(auth -> auth
.requestMatchers("/auth/**").permitAll()
.anyRequest().authenticated()
)
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.authenticationProvider(authenticationProvider)
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues();
//configuration.setAllowedOrigins(List.of("*"));
configuration.setAllowedOrigins(List.of("http://192.168.246.108:3000","capacitor://localhost", "http://localhost", "http://localhost:3000","http://10.0.2.2","http://10.0.2.2:3000" ));
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
configuration.setAllowedHeaders(List.of("Authorization", "Content-Type", "Access-Control-Allow-Origin"));
configuration.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
< /code>
И вот некоторые конфигурации конденсаторов: < /p>
192.168.246.108
< /code>
android manifest.xml:
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
< /code>
Также мой компьютер в большинстве случаев подключен к горячей точке, я пытался запустить его, подключенный к тому же Wi -Fi, что и телефон, но все же те же результаты. Может ли горячая точка повлиять на процесс? Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/796 ... ring-serve
Мобильная версия