4

I am working with Intelij 2018 and the project works with wildfly 8.1 final. I change header setting in the file, but once I run the project the file is changed back and all setting are lost.

    <!-- configuration to change -->
    <filters>
        <response-header name="Access-Control-Allow-Origin"
            header-name="Access-Control-Allow-Origin" header-value="*" />
        <response-header name="server-header" header-name="Server"
            header-value="WildFly/8" />
        <response-header name="x-powered-by-header"
            header-name="X-Powered-By" header-value="Undertow/1" />
        <response-header name="Access-Control-Allow-Headers"
            header-name="Access-Control-Allow-Headers"
            header-value="origin, content-type, accept, authorization, application" />
        <response-header name="Access-Control-Allow-Credentials"
            header-name="Access-Control-Allow-Credentials" header-value="true" />
        <response-header name="Access-Control-Allow-Methods"
            header-name="Access-Control-Allow-Methods" header-value="GET, POST, PUT, DELETE, OPTIONS, HEAD" />
        <response-header name="Access-Control-Max-Age"
            header-name="Access-Control-Max-Age" header-value="1209600" />
    </filters>

From which file the basic configuration is taken I will modify it.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
developer learn999
  • 365
  • 1
  • 4
  • 17
  • Are you making the change to a running instance of JBoss? You're not supposed to as JBoss will overwrite your changes while it is running unless it's done through the Web UI or the CLI – JGlass Oct 02 '18 at 17:21
  • i want to add different headers under filters (i tried to put it in the post but it doesn't show) - how do i do it from CLI? – developer learn999 Oct 02 '18 at 18:02
  • This might help you out [configure http headers in jboss eap 7](https://stackoverflow.com/questions/48643257/configure-http-headers-in-jboss-eap-7/48644674#48644674). Using the CLI is too complicated to explain. I'd recommend stopping JBoss, backup the standalone.xml file. Ensure it's backed up, then find the section in my link! If it helps you out you can up vote it. If you're still having problems let me know! – JGlass Oct 02 '18 at 18:05
  • i did same as in the link, but once i run the intelij it over rides the file. – developer learn999 Oct 02 '18 at 19:02
  • Is WildFly running on port 8080? If so open a browser and go to http://localhost:8080. The default page should load. Stop Wildfly in IntelliJ. Go to http://localhost:8080 and make sure the page *doesn't* load. If it does - IntelliJ is not shutting down WildFly. Try shutting down IntelliJ and see if the page still loads, if it does, you need to manually shutdown WildFly. Are you sure IntelliJ is running WildFly with standalone.xml and not standalone-full.xml or standalone-ha.xml? A google showed that IntelliJ generally never touches standalone.xml except to alter the deployments tag. – JGlass Oct 02 '18 at 19:37
  • @JGlass my project run's on 8080, once i stop the project the port doesn't work. after i updated the standalone.xml i see that my files again override once i run it. this why i try to figure out which file he uses as the source file and edit that one https://snag.gy/qViYOp.jpg – developer learn999 Oct 02 '18 at 20:24
  • Somethings wrong with that image you posted, can you try again? – JGlass Oct 02 '18 at 20:39
  • i hope this link works http://oi68.tinypic.com/2j0nqtf.jpg – developer learn999 Oct 02 '18 at 22:10
  • What does your settings show here [IntelliJ Wildfly Settings](https://imgur.com/a/WqNJKvx) under run/debug configuration. Also, stupid question but whens the laptop or desktop you're developing on been rebooted last? I'm wondering if possibly theres not a second JBoss instance running? – JGlass Oct 03 '18 at 14:17
  • this are my settings https://imgur.com/a/SFFIY8h and i don't have second wildfly running – developer learn999 Oct 08 '18 at 08:57
  • The images doesnt show the startup script setting and whether default is checked or unchecked. Is it checked and if so, whats the startup script line read/say? – JGlass Oct 08 '18 at 18:17
  • Did you get to try my answer to see if it helped? – JGlass Oct 09 '18 at 14:19
  • Following up ;-) – JGlass Oct 10 '18 at 19:51
  • @JGlass it works! – developer learn999 Oct 11 '18 at 20:52
  • Awesome dev! Glad we got it working. If you don't mind, you can mark the answer as correct - theres a little shaded out checkbox under the zero and down arrow. Thanks and glad we could get it working! – JGlass Oct 11 '18 at 21:50

1 Answers1

5

I think I may have found a solution for you - it may revolve around a bug.

  1. Stop Wildfly through intelliJ.
  2. Close intelliJ.
  3. Make sure WildFly is not listening on 8080 in browser
  4. In standlone/configuration - make a backup of the standalone_xml_history folder either by creating a zip file of it or creating a folder copy and append _bak to it
  5. Delete everything in the folder especially the folders current and snapshot.
  6. Make your changes to the file.
  7. Open intelliJ.
  8. Start JBoss.
  9. Cross your fingers.
  10. If it worked - PROFIT!

If this works it was found via a hint from this JBoss forums page How to write on standalone.xml permanently?
Let me know if it worked!

JGlass
  • 1,427
  • 2
  • 12
  • 26