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.

15
  • 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 2, 2018 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? Oct 2, 2018 at 18:02
  • This might help you out configure http headers in jboss eap 7. 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 2, 2018 at 18:05
  • i did same as in the link, but once i run the intelij it over rides the file. Oct 2, 2018 at 19:02
  • Is WildFly running on port 8080? If so open a browser and go to localhost:8080. The default page should load. Stop Wildfly in IntelliJ. Go to 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 2, 2018 at 19:37

1 Answer 1

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!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.